[stunnel-users] [PATCH] Fix undefined aliasing in libwrap.c
Michal Trojnara
Michal.Trojnara at mobi-com.net
Sat May 2 23:10:49 CEST 2009
Ludolf Holzheid wrote:
> In fact, accessing objects at addresses not suitable aligned leads to
> strange effects on some machines (e.g. ARM9 or C165), but this fact is
> not even mentioned in IEC9899:1999 (a.k.a. C99).
You're right. memcpy() is a safe way to assure proper alignment.
> Even worse C99 _defines_ void* to "have the same representation and
> alignment requirements as a pointer to a character type", which is not
> suitable the vast majority of the objects one could have pointers
> for. A nightmare for static code checkers ...
The whole idea of C is a nightmare for static code analyzers... C is
basically a structured, cpu-independent assembler. A programmer
writing C code can easily see how it's going to be translated for a
specific CPU. Nothing is added automatically by the compiler. This
is why I'm such a big fan of C. 8-)
Best regards,
Mike
More information about the stunnel-users
mailing list