[Bug 269] Many compiler warnings with gcc 4.0

Frank Cusack fcusack at fcusack.com
Wed Aug 31 22:21:43 CEST 2005

On August 31, 2005 4:09:49 PM -0400 Alan DeKok <aland at ox.org> wrote:
> Frank Cusack <fcusack at fcusack.com> wrote:
>> Forcing unsigned char would be a mistake, IMHO.  I personally think casts
>> are good.  One man's ugly notation is another man's inline documentation.
>   The casts hilight API incompatibilities, and potential security
> issues.
>   Maybe since we're doing massive re-writes anyhow, we could have:
> 	 union {
> 	       char strvalue[];
> 	       uint8_t octets[];
> 	       ...	
> 	 } data;
> }
>   And then use the "right" data member to access the data.  "uint8_t"
> shouldn't be passed to "strcpy", especially if we're using "uint8_t"
> as "opaque data".

I personally dislike that, however I have seen other pieces of code that
did similar things to avoid casts.  Myself, I find it quite hard to read.
Not sure why you'd use uint8_t instead of unsigned char though.


More information about the Freeradius-Devel mailing list