pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: constness


From: John Darrington
Subject: Re: constness
Date: Sun, 12 Nov 2006 06:45:14 +0800
User-agent: Mutt/1.5.4i

On Sat, Nov 11, 2006 at 11:45:13AM -0800, Ben Pfaff wrote:
     John Darrington <address@hidden> writes:
     
     > Any objections if I add a const version of the hash table in
     > src/libpspp/hash.c ?
     
     What's const?  The objects in the hash table?  

Yes.  In fact, I'll probably do it the other way around.  The default
(the one with the existing name) will be the const one, and I'll add a
mutable version, since most often the objects are (or should be) const.

     I assume that the functions will just be wrappers around the
     existing ones, plus casts?

That's one way of doing it.  The other idea I had was to use some
macro magic to create two versions from an initial specification
... Oh for C++ templates!

     > I'm getting annoyed at the number of times I can't declare something
     > const which really ought to be.
     
     I'm not really sure how often "const" is really useful for
     finding bugs, but OK.

In my experience, it can be useful, but only if *everything* is written
to be const correct.   Having it right only in some places doesn't
help at all.

J'


-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.


Attachment: pgp31BE4BWoya.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]