unsafe typedefs?

Will Fiveash William.Fiveash at sun.com
Mon Nov 28 23:33:30 EST 2005

In the latest MIT src/include/krb5.h I see:

typedef void * krb5_pointer;
typedef void const * krb5_const_pointer;

I'm thinking that instead something like:

typedef struct foo * krb5_pointer;
typedef struct foo const * krb5_const_pointer;

where struct foo is an incomplete struct type would be safer.  This
would allow the compiler to catch mismatches between the function
parameter and the given arg (realize that void * == void ** == void ***
and so on in C).  Note, I did this for some typedefs in our libgss and
we flushed out several bugs.  Just a thought.

Will Fiveash
Sun Microsystems Inc.
Austin, TX, USA (TZ=CST6CDT)

More information about the krbdev mailing list