From owner-cvs-all Wed Jan 3 15:13:52 2001 From owner-cvs-all@FreeBSD.ORG Wed Jan 3 15:13:48 2001 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from hand.dotat.at (sfo-gw.covalent.net [207.44.198.62]) by hub.freebsd.org (Postfix) with ESMTP id B13FE37B400; Wed, 3 Jan 2001 15:13:47 -0800 (PST) Received: from fanf by hand.dotat.at with local (Exim 3.15 #3) id 14Dx5W-000HoF-00; Wed, 03 Jan 2001 23:12:58 +0000 Date: Wed, 3 Jan 2001 23:12:58 +0000 From: Tony Finch To: Bruce Evans 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 Message-ID: <20010103231258.F6550@hand.dotat.at> References: <20010102133120.M47732@hand.dotat.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i In-Reply-To: Organization: Covalent Technologies, Inc Sender: fanf@dotat.at Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Bruce Evans 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