home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / ada / 2487 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  2.0 KB

  1. Path: sparky!uunet!munnari.oz.au!yoyo.aarnet.edu.au!sirius.ucs.adelaide.edu.au!cs.adelaide.edu.au!andrewd
  2. From: andrewd@cs.adelaide.edu.au (Andrew Dunstan)
  3. Newsgroups: comp.lang.ada
  4. Subject: Re: ADA question
  5. Message-ID: <8378@sirius.ucs.adelaide.edu.au>
  6. Date: 31 Aug 92 04:20:54 GMT
  7. References: <1992Aug27.004228.19551@evb.com> <64955@cup.portal.com>
  8. Sender: news@ucs.adelaide.edu.au
  9. Lines: 36
  10. Nntp-Posting-Host: achilles.cs.adelaide.edu.au
  11.  
  12. In article <64955@cup.portal.com>, R_Tim_Coslet@cup.portal.com writes:
  13. |> In article: <8363@sirius.ucs.adelaide.edu.au>
  14. |>     andrewd@cs.adelaide.edu.au (Andrew Dunstan) writes...
  15. [..]
  16. |> > DECLARE
  17. |> >    String_Const : CONSTANT String := My_String_Function;
  18. |> >    String_Var : String (String_Const'RANGE) ;
  19. |> >    for string_var use at string_const'address ;
  20. |> > BEGIN
  21. |> >    Process (String_Var) ; -- parameter's mode: IN OUT
  22. |> > END ;
  23. |> > 
  24. [..]
  25. |> 
  26. |> OUCH! Don't ever do this! It is expressly forbidden in the Ada LRM to use
  27. |> the "for ... use at" clause for the purpose of overlaying data structures
  28. |> on top of each other and the results are totally undefined (especially if
  29. |> you are trying to overlay constants and variables... the constant might
  30. |> have been placed in ROM by the compiler and linker in certain environments)!
  31. |> 
  32. |> 
  33.                                         R. Tim Coslet
  34. Thanks for pointing this out - I did actually look in the LRM before I
  35. posted, but obviously not hard enough! Finding these little things in the
  36. LRM is like looking for a needle in a haystack.
  37.  
  38. Still, mea culpa.
  39.  
  40. -- 
  41. #######################################################################
  42. #  Andrew Dunstan                   #   There's nothing good or bad   #
  43. #  Department of Computer Science   #   but thinking makes it so.     #
  44. #  University of Adelaide           #                                 #
  45. #  South Australia                  #          - Shakespeare          #
  46. #  net: andrewd@cs.adelaide.edu.au  #                                 #
  47. #######################################################################
  48.