From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ccb8bd6b4c3162fd X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Beginner's questions Date: 1999/05/10 Message-ID: <3737122F.88561124@averstar.com>#1/1 X-Deja-AN: 476238107 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: <7gkq7e$dcm$1@nnrp1.dejanews.com> <7gn3ho$c0e$1@nnrp1.dejanews.com> Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-10T00:00:00+00:00 List-Id: dennison@telepath.com wrote: > > In article , > stt@houdini.camb.inmet.com (Tucker Taft) wrote: > > If you use "type String_Ptr is access constant String" to > > declare your pointer type, then the language prevents > > erroneous overwriting of the strings, and the compiler > > (if it follows the Ada 95 implementation advice) will > > allocate and initialize the pointed-to strings at link-time, rather than > > run-time, exactly like "C" string literals. > > Ohhhhh, nifty! That was effectively an Ada 83 code chunk I posted. I'll have > to remember to use "access constant" next time it comes up. > > Does your last sentence only apply for package specs and bodies, not for > subprograms? When I use this trick, its typically in my "main" subprogram. It should work in all environments, when the initial value is known statically. However, this is just implementation advice, and I can imagine that some compilers are not yet doing the right thing. > > -- > T.E.D. -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA