Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Feb 2002 00:43:39 -0500
From:      Mike Barcroft <mike@FreeBSD.ORG>
To:        "Jacques A. Vidrine" <nectar@FreeBSD.ORG>
Cc:        Chuck Rouillard <chuckr@opus.sandiegoca.ncr.com>, FreeBSD-Standards <freebsd-standards@FreeBSD.ORG>
Subject:   Re: pathchk - review
Message-ID:  <20020217004339.J57687@espresso.q9media.com>
In-Reply-To: <20020217020217.GB46829@madman.nectar.cc>; from nectar@FreeBSD.ORG on Sat, Feb 16, 2002 at 08:02:18PM -0600
References:  <20020129210829.GC50337@madman.nectar.cc> <20020205232519.N7805-101000@opus.sandiegoca.ncr.com> <20020212170303.B55750@espresso.q9media.com> <20020217020217.GB46829@madman.nectar.cc>

next in thread | previous in thread | raw e-mail | index | archive | help
Jacques A. Vidrine <nectar@FreeBSD.ORG> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020217004339.J57687>