Date: Wed, 3 Jan 2001 19:46:43 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Tony Finch <dot@dotat.at> 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: <Pine.BSF.4.21.0101031929540.13047-100000@besplex.bde.org> In-Reply-To: <20010102133120.M47732@hand.dotat.at>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2 Jan 2001, Tony Finch wrote: > Matthew Jacob <mjacob@feral.com> wrote: > > > >The whole approach ANSI seems to have taking is moronic since it's very clear > >to me that either you should have clear object attributes, or you should have > >the most permissive interpretation of default attributes. If you want to make > >an object have some other than default attribute, be specific- don't be > >ambiguous. > It is actually clear in this case: literal strings are arrays of const > chars and therefore should not be modified. Actually, literal strings are arrays of plain chars. Their non-modifyability is specified explicitly since it doesn't follow from const'ness. > The ambiguity you are > complaining about is there so that implementers can either enforce > this or not, depending on hardware and/or OS support. 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. */ --- Use `gcc -Wwrite-strings' if you don't want warnings for possibly modifying string literals. This makes literal strings arrays of const chars. I think this doesn't break standards conformance of gcc, since it only causes more diagnostics. Bruce 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?Pine.BSF.4.21.0101031929540.13047-100000>