From owner-cvs-all Wed Jan 3 0:46:27 2001 From owner-cvs-all@FreeBSD.ORG Wed Jan 3 00:46:22 2001 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id C41A037B400; Wed, 3 Jan 2001 00:46:20 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id TAA15464; Wed, 3 Jan 2001 19:45:51 +1100 Date: Wed, 3 Jan 2001 19:46:43 +1100 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Tony Finch Cc: Matthew Jacob , =?iso-8859-1?Q?G=E9rard_Roudier?= , Peter Wemm , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/isp isp.c In-Reply-To: <20010102133120.M47732@hand.dotat.at> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 2 Jan 2001, Tony Finch wrote: > Matthew Jacob 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