Holger Joukl <[EMAIL PROTECTED]> wrote:

> I know the reinterpret_cast is evil, but what´s *invalid* about it given
> that I know that int is the same as long on my machine?

int and long are different types, according to C++. The fact they have the
same representation on a given platform does not matter. Accessing an object
of type T1 through a pointer of type T2 (with T1 and T2 unrelated, and with
the exception of T2=char) is invalid as per the aliasing rules specified in
the ISO C++ standard. Modern compilers exploit this: if they see a long* and
an object of type int, they can assume that the long* will never point to
the int object, and thus will not be able to modify its contents in any way.

This is off-topic though :)
-- 
Giovanni Bajo

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to