On Sun, 2002-01-20 at 15:27, Garrett Rooney wrote:
> On Sun, Jan 20, 2002 at 07:23:25PM +0000, Philip Martin wrote:
> > Garrett Rooney <rooneg@electricjellyfish.net> writes:
> >
> > > > > + apr_hash_this(hi, (const void **)&key, NULL, (void **)&val);
Code like this is not strictly correct C. "key" is a char *, and its
address is a char **. If you cast this to void **, dereference it, and
assign to that, you're assigning a void * value to a char * slot without
a cast conversion.
Of course, on almost all platforms, void * is bit-identical to all the
pointer types it is compatible with, and cast conversions between
pointer types do nothing. But if you care about strictly conforming to
the standards (which, admittedly, most Subversion developers don't),
you'll avoid this kind of looseness.
So, it is cleaner to declare key as void * and cast it to char * (or
assign its value to a char * variable) when you need to use it as such,
but some might find it best to simply minimize the number of casts
regardless of cleanliness.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:57 2006