Date: Wed, 11 Jul 2007 02:46:19 +0400 From: Andrey Chernov <ache@nagual.pp.ru> To: Peter Jeremy <peterjeremy@optushome.com.au> Cc: freebsd-current@freebsd.org Subject: Re: HEADS UP: getenv() and family API change Message-ID: <20070710224619.GA31654@nagual.pp.ru> In-Reply-To: <20070710213602.GX3434@turion.vk2pj.dyndns.org> References: <20070703182400.Q1449@baba.farley.org> <Xuu8UV3Bay@dmeyer.dinoex.sub.org> <20070709145418.T52164@thor.farley.org> <20070710154148.GA22873@nagual.pp.ru> <20070710213602.GX3434@turion.vk2pj.dyndns.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Wed, Jul 11, 2007 at 07:36:02AM +1000, Peter Jeremy wrote: > On 2007-Jul-10 19:41:48 +0400, Andrey Chernov <ache@nagual.pp.ru> wrote: > >To say strictly, copying somewhere is not neccessary since this way works > >too: > > > >static char *s = "PATH=/bin"; > > > >putenv(s); > > I thought the C compiler was still free to place the string into RO > memory and/or coalesce it with other strings in that case. > > Wouldn't the following be clearer (s is forced to be writable): > > static char s[] = "PATH=/bin"; > > putenv(s); This two are the same, since there is no "const", so compiler can't put static char *s into RO memory. -- http://ache.pp.ru/ [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFGlAw7Vg5YK5ZEdN0RAjl8AJwJ85GF5IJkES6KLfdndc5gZRlCeACgmmeM HEca1pnei6L5KKkIOGhnxas= =LM8H -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070710224619.GA31654>
