[m-rev.] Posix environment

Fergus Henderson fjh at cs.mu.OZ.AU
Wed May 22 19:22:57 AEST 2002


On 22-May-2002, Michael Day <mikeday at bigpond.net.au> wrote:
> One question though, should it copy the
> strings from the environment rather than returning them directly?

Yes, IMHO it should.  Otherwise they might alias with non-const strings
that can be modified by C code.  The Posix standard allows programs to
add strings to environ and modify them afterwards:

	| int putenv(char *string);
	| ...
	| the string pointed to by `string' shall become part of the
	| environment, so altering the string shall change the environment. 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list