On Fri, 22 May 2009, Szak�ts Viktor wrote:

Hi,


> FYI, otherwise the build process went smoothly, I'll make some speed
> tests later:
> ../../binnum.c:115: warning: dereferencing type-punned pointer will
> break strict-aliasing rules
[...]

All of above warnings are hacks introduced in x86 builds where
HB_STRICT_ALIGNMENT macros is not defined in places where some
binary data is read from memory in some strictly defined byte
order, f.e. from PCODE or binary files. x86 CPUs can read data
even if they do not pass valid alignment, f.e. if we have in two
bytes at ptr address little endian unsigned 16bit value then we
can make hack and use:

   usVal = * ( USHORT * ) ptr;

instead of:

   usVal = ( ptr[ 1 ] << 8 ) | ptr[ 0 ];

If processor needs strict alignment then such hacks cannot be used
because they cause CPU exception and application crash. If you compile
Harbour with HB_STRICT_ALIGNMENT macro then it should pacify all such
warnings but it will also reduce a little bit the performance on x86
machines because it disables such explicit casting when PCODE is decoded.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to