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

In article <EACHUS.98Oct6194412@spectre.mitre.org>,
  eachus@spectre.mitre.org (Robert I. Eachus) wrote:
> 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...


I find this a specious argument, it would equally well apply to constants
at the global level which you allowed C to modify, and there is no way of
generating inefficient code to allow this to "work" whatever that means.

A constant is a constant, it cannot be modified after declaration time. If
you have your C code modify it that is morally equivalent to having C destroy
your Ada generated code by poking at it. This is just plain junk buggy code,
and it is absurd to generate deliberately suboptimal code so that this
particularly bug can be got away with!

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




  reply	other threads:[~1998-10-07  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
1998-10-07  0:00         ` dewarr [this message]
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