[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] fix for issue #591

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2002-01-20 23:20:20 CET

On Sun, Jan 20, 2002 at 04:45:53PM -0500, Greg Hudson wrote:

> 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.

well, in light of this, i've rewritten the code using const void *key
and void *val.

thanks for the tip.

-garrett

-- 
garrett rooney                     Unix was not designed to stop you from 
rooneg@electricjellyfish.net       doing stupid things, because that would  
http://electricjellyfish.net/      stop you from doing clever things.
---------------------------------------------------------------------
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

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.