[PATCH] fix KJS crash on some more strict platforms

Adriaan de Groot adridg at cs.kun.nl
Tue Dec 16 22:32:07 GMT 2003


On Tuesday 16 December 2003 22:08, Helge Deller wrote:
> Code like this (taken from kdelibs/kjs/internal.cpp):
> const unsigned char NaN_Bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
> ....
> double x = * (double*) NaN_Bytes;

From LISP systems I've seen, a solution is

union { char NaN_Bytes[8];
	double NaN_Double;
	} NaN_Representation;

which presumably forces the whole union to the alignment of the strictest 
type. Neater than using a gcc extension.

-- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot at kde.org>
            If the door is ajar, can we fill it with door-jamb?




More information about the kde-core-devel mailing list