comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com
Subject: Re: Beginner's questions
Date: 1999/05/04
Date: 1999-05-04T00:00:00+00:00	[thread overview]
Message-ID: <7gn3ho$c0e$1@nnrp1.dejanews.com> (raw)
In-Reply-To: FB6yDx.53x.0.-s@inmet.camb.inmet.com

In article <FB6yDx.53x.0.-s@inmet.camb.inmet.com>,
  stt@houdini.camb.inmet.com (Tucker Taft) wrote:
> dennison@telepath.com wrote:
>
> : If you won't need to change the contents of the strings, one quick-and-dirty
> : method is the following:
>
> : type String_Ptr is access String;
>                           ^^^ "constant"
>
> 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.

--
T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1999-05-04  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-02  0:00 Beginner's questions Marco Schmidt
1999-05-02  0:00 ` Matthew Heaney
1999-05-03  0:00   ` Marco Schmidt
1999-05-03  0:00     ` Matthew Heaney
1999-05-03  0:00 ` Andreas Winckler
1999-05-03  0:00   ` Matthew Heaney
1999-05-03  0:00     ` Andreas Winckler
1999-05-03  0:00       ` David Starner
1999-05-04  0:00         ` Andreas Winckler
1999-05-04  0:00           ` Larry Kilgallen
1999-05-04  0:00             ` Martin C. Carlisle
1999-05-04  0:00               ` Larry Kilgallen
1999-05-05  0:00                 ` Andreas Winckler
1999-05-03  0:00 ` dennison
1999-05-04  0:00   ` Tucker Taft
1999-05-04  0:00     ` dennison [this message]
1999-05-10  0:00       ` Tucker Taft
1999-05-04  0:00 ` czgrr
1999-05-04  0:00   ` Nick Roberts
1999-05-07  0:00     ` Robert Dewar
1999-05-07  0:00       ` David Starner
1999-05-08  0:00         ` ak
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox