Date: Wed, 3 Jan 2001 23:12:58 +0000 From: Tony Finch <dot@dotat.at> To: Bruce Evans <bde@zeta.org.au> Cc: Matthew Jacob <mjacob@feral.com>, =?iso-8859-1?Q?G=E9rard_Roudier?= <groudier@club-internet.fr>, Peter Wemm <peter@netplex.com.au>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/isp isp.c Message-ID: <20010103231258.F6550@hand.dotat.at> In-Reply-To: <Pine.BSF.4.21.0101031929540.13047-100000@besplex.bde.org> References: <20010102133120.M47732@hand.dotat.at> <Pine.BSF.4.21.0101031929540.13047-100000@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <bde@zeta.org.au> wrote: > >Actually, literal strings are arrays of plain chars. Gah! >Their non-modifyability is specified explicitly since it doesn't >follow from const'ness. Why doesn't it follow? The C standard uses pretty much the same language to say that string literals and const objects shouldn't be modified ("behaviour is undefined"). [I'm looking at the C99 draft.] >Enforcement of const'ness is also optional. The non-const'ness of the >chars in literal strings gives implementors even more freedom. E.g.: > >--- >void foo(char *); >char *bar; >... > foo(bar); /* Diagnostic required. */ > foo("string literal"); /* Diagnostic not required. */ >--- Was there supposed to be a const in there somewhere? >Use `gcc -Wwrite-strings' if you don't want warnings for possibly >modifying string literals. Surely "... if you do want ..."? Tony. -- f.a.n.finch fanf@covalent.net dot@dotat.at "Plan 9 deals with the resurrection of the dead." To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010103231258.F6550>