On Sat, 2006-11-11 at 22:18 -0800, Ian Lance Taylor wrote:
> 
> Your code will be safe on all counts if you change buf from int[] to
> char[].  The language standard grants a special exemption to char*
> pointers.  Without that exemption, it would be impossible to write
> malloc in C.

Actually it is not that what the C standard allows.  What the C standard
says is accesses via the character type is always valid and the normal
type (and signed/unsigned version of both the normal and character
type).  This means accessing an element of the character array via any
other type except via an unsigned/signed character type is undefined.

Thanks,
Andrew Pinski

Reply via email to