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

Re: CVS update: subversion/subversion/libsvn_subr svn_string.c

From: Greg Stein <gstein_at_lyra.org>
Date: 2000-10-14 08:40:35 CEST

On Fri, Oct 13, 2000 at 09:42:17PM -0500, Karl Fogel wrote:
> (The main casting I see going on is when we cast all those (void *)
> batons and userData arguments back to their rightful types at the top
> of parser and editor callback functions. Those casts are fairly
> numerous, and as far as I understand, they are necessary too.)

Euh... not necessary. This is totally legit:

   some_struct_type *foo = some_void_ptr;

There is an implicit cast in there.

What you cannot do, however, is take the address of a void* variable and
pass it as a some_type** argument. In other words:

   BAD: call_some_func(&void_ptr);
   GOOD: my_type *foo = void_ptr;

There are implicit casts to/from void ptrs in assignments and func calls.

[ example: fetch.c::fetch_file_reader() ... no cast on the userdata ]


Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:11 2006

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