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,ed86965848f8610b X-Google-Attributes: gid103376,public From: dewarr@my-dejanews.com Subject: Re: Reading environment variables in ADA? Date: 1998/10/07 Message-ID: <6vfgvo$ja0$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 398589707 References: <6tdl75$qs6$2@nyheter.chalmers.se> <6vdgvv$2h3$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x10.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Wed Oct 07 10:49:28 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.02 (OS/2; I) Date: 1998-10-07T00:00:00+00:00 List-Id: In article , 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