invalid offsetof from non-POD type

John Quigley johnw@lowestplane.org
Fri Apr 25 08:07:00 GMT 2003


> As I pointed out in the followup to Zack's message, what does it mean
> to produce the "right" answer for a member whose type has a virtual
> base class?  What is the "right" answer for member from a virtual base
> class?

Maybe there is no right answer for these cases, but doesn't gcc already have 
code to flag them as an error? (in gcc 3.2.2, gcc/cp/typeck.c line 2178)  It 
seems as if it already distinguishes between the undefined and the 
well-defined cases.

Perhaps it would be useful if I described how the code that I'm working on 
uses offsetof.  It is the Torque game engine from www.garagegames.com.  The 
engine has an internal c-like scripting language.  The fields and methods of 
the c++ classes in the engine can be exposed to this scripting language.  For 
each field, the engine uses offsetof to compute the offset of the field in 
the class.  Later on, when the scripts read or write to the field, the script 
runtime locates the field by adding the offset to the base pointer of the 
object in question.

Thanks for considering this issue.



More information about the Gcc mailing list