Topic: offsetof macro, can it be used in non-triv


Author: stephen.clamage@eng.sun.com (Steve Clamage)
Date: 1996/12/18
Raw View
In article c07797cd@hacknowledge, "MC" <contem00@cam.org> writes:
>How reliable is the offsetof macro when used on a complex class under MI?

The offsetof macro has defined results only for POD-structs or
POD-unions. A POD ("plain old data") is, to oversimplify, something
that would be allowed in C.

Use pointers to members instead of offsetof with C++ classes.
---
Steve Clamage, stephen.clamage@eng.sun.com
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]