This might not belong to this forum...
I'd like to port a large project (ZDoom) to mingw-2.0,
thought it would be easy
because it already builds with gcc 3.0 on Linux and with
MS VC on win32.
But I cannot compile some ugly pointer (offsetting into a
Looked at the (Linux) gcc3.0 makefile but didn't find any
switch or option explaining
why gcc3.0 eats this code and why the mingw gcc3.2 does
Original pointer declaration:
produces invalid offsetof from non-POD...
use pointers to members instead warning, so I changed it to
and it compiles fine. But with the second member I got
the original code is as before:
will not compile, nor my attempt with the trick above:
complaining member not declared as static.
What am I doing wrong?
From: Benjamin Riefenstahl <Benjamin.R<iefenstahl@ep...> - 2002-12-09 16:54:29
MegaMole <yorikiri@...> writes:
> use pointers to members instead warning, so I changed it to
> (size_t)&ThisClass::getspawned; and it compiles fine.
But I think it most likely doesn't do what you intend, or it does it
only by a rare accident. Using casts like your (size_t) with pointers
to members is a recipe for desaster. Use the correct syntax and the
code is safe. I admit that the correct syntax is one of the more
involved chapters of C++.
Can you give us the actual code that you are using, including where
you are using the offsets? Preferably in a form, so that we can
compile it in isolation?
so long, benny