comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: Reading environment variables in ADA?
Date: 1998/10/06
Date: 1998-10-06T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.98Oct6194412@spectre.mitre.org> (raw)
In-Reply-To: 6vdgvv$2h3$1@nnrp1.dejanews.com

In article <6vdgvv$2h3$1@nnrp1.dejanews.com> dewarr@my-dejanews.com writes:

 > Note that if you declare a *constant* aliased string, then a good compiler
 > should not even allocate stack space, but instead allocate the constant
 > statically. This is what GNAT does, and I believe that at least some other
 > Ada compilers do this same optimization.

   Sorry, I have to recommend against this.  It is a constant to YOU,
but when it is passed to the C code, it is not.  I have found bugs in
both X windows and Solaris where the string is not actually changed,
but it is written to!  So if you pass a pointer to a string in the
code, you get a fault when the write occurs.  (Actually I suspect that
the terminating nul is rewritten.)

   (Don't ask me how these bugs occured, or why, and yes AFAIK, the
ones I have found have been fixed.  But it leads me to believe that
there are others.)
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  reply	other threads:[~1998-10-06  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-12  0:00 Reading environment variables in ADA? Stefan Lingdell
1998-09-12  0:00 ` David C. Hoos, Sr
1998-09-13  0:00 ` Steven Hovater
1998-09-17  0:00 ` Gisle S{lensminde
1998-10-06  0:00   ` Matthew Heaney
1998-10-06  0:00     ` dewarr
1998-10-06  0:00       ` Robert I. Eachus [this message]
1998-10-07  0:00         ` dewarr
1998-10-07  0:00           ` Robert I. Eachus
1998-10-13  0:00             ` Simon Wright
1998-09-17  0:00 ` Matthew Heaney
replies disabled

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