apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: svn commit: r412252 - /apr/apr-util/trunk/dbd/apr_dbd_sqlite2.c
Date Wed, 07 Jun 2006 11:58:03 GMT
On Wed, Jun 07, 2006 at 09:50:06PM +1000, Bojan Smojver wrote:
> On Wed, 2006-06-07 at 12:44 +0100, Joe Orton wrote:
> 
> > Another useful thing that can be done in general is to do e.g.
> > 
> > static apr_status_t blah(void *data)
> > {
> >    char *foo = data;
> >    the_function(foo)
> > 
> > since passing a variable of the right type to the function rather than 
> > just void * gives better type-safety.
> 
> Is this something that inherent in C spec, or is it something that some
> compilers tend to screw up?

Oh, it's just that you get type-checking against the argument you pass 
to the_function.  If you pass a "void *" there is (essentially) no type 
safety.  e.g. a stupid example, if the_function() was changed to take an 
"int *" above, you'd get a type warning.  If you only passed the "void 
*", you wouldn't.

This is not really a concern with use of sqlite2, but I think it's a 
good idea in general ;)

Regards,

joe

Mime
View raw message