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: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: Reading environment variables in ADA? Date: 1998/10/06 Message-ID: #1/1 X-Deja-AN: 398450667 References: <6tdl75$qs6$2@nyheter.chalmers.se> <6vdgvv$2h3$1@nnrp1.dejanews.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-10-06T00:00:00+00:00 List-Id: 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...