Benjamin Grange writes: > On 11/3/06, Andrew Haley <aph@xxxxxxxxxx> wrote: > > This is a bug in your code. > Could you explain me why please? > > > If you really need to break the type > > system by accessing an object by something other than its real type, > > use a union: > > > > union > > { > > A A_kludge; > > unsigned int uint_kludge[2]; > > void *nonsense; > > } kludge; > > > Unfortunally it doesn't work in my case because A has a contructor > and gcc doesn't want to put a class with a constructor in an union > (error: member 'A topointer(A)::<anonymous union>::A_kludge' with > constructor not allowed in union). > Furthermore, even if it worked I will have to do this: > kludge.uint_kludge[1] = 0; > and I don't think it will work on a 64bits big endian processor. > > Do you see a problem in this line?: > (void *) (unsigned long)(*(((unsigned int *)&a))); Yes, I can: it's not legal C++. What are you really tring to do that needs this? Andrew.