From owner-freebsd-standards Sat Feb 16 21:47:52 2002 Delivered-To: freebsd-standards@freebsd.org Received: from espresso.q9media.com (espresso.q9media.com [216.254.138.122]) by hub.freebsd.org (Postfix) with ESMTP id 3AA0A37B400; Sat, 16 Feb 2002 21:47:48 -0800 (PST) Received: (from mike@localhost) by espresso.q9media.com (8.11.6/8.11.6) id g1H5hdP11622; Sun, 17 Feb 2002 00:43:39 -0500 (EST) (envelope-from mike) Date: Sun, 17 Feb 2002 00:43:39 -0500 From: Mike Barcroft To: "Jacques A. Vidrine" Cc: Chuck Rouillard , FreeBSD-Standards Subject: Re: pathchk - review Message-ID: <20020217004339.J57687@espresso.q9media.com> References: <20020129210829.GC50337@madman.nectar.cc> <20020205232519.N7805-101000@opus.sandiegoca.ncr.com> <20020212170303.B55750@espresso.q9media.com> <20020217020217.GB46829@madman.nectar.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020217020217.GB46829@madman.nectar.cc>; from nectar@FreeBSD.ORG on Sat, Feb 16, 2002 at 08:02:18PM -0600 Organization: The FreeBSD Project Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Jacques A. Vidrine writes: > On Tue, Feb 12, 2002 at 05:03:03PM -0500, Mike Barcroft wrote: > > > const char *illegalchar = "pathchk: Illegal character"; > > > const char *memoryerror = "pathchk: No memory to allocate"; > > > const char *nametoolong = "pathchk: Path component too long"; > > > const char *pathchkhelp = "usage: pathchk [-p] path ...\n"; > > > const char *pathtoolong = "pathchk: Pathname too long"; > > > const char *posix_chars = "0123456789._-" > > > "ABCDEFGHIJKLMNOPQRSTUVWXYZ" > > > "abcdefghijklmnopqrstuvwxyz"; > > > > These should all be #define's, > > Why? Here's part of a private discussion I had with the author regarding this: : My suggestion was mostly for making the code easier to read than for : optimization. It's much clearer that variables are read-only when : the variable name is in caps and the variable is actually a manifest : constant. > > unless I missed somewhere that they are > > changed. > > They are const :-) The type is a pointer to a read-only string. The type he was really looking for was a read-only pointer to a read-only string: const char * const VARIABLE; But as I suggested, manifest constants are better. Best regards, Mike Barcroft To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message