Topic: Submission for comp-std-c++
Author: cardboard.mti.sgi.com!sgi.com!murphy.com!dwrsun4!uucp (0000-uucp(0000))
Date: 1996/12/18 Raw View
Path: dwrsun4!jmx.net!ns3.maslink.com!news-out.internetmci.com!newsfeed.internetmci.com!super.zippo.com!zdc!su-news-hub1.bbnplanet.com!news.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.idt.net!cdc2.cdc.net!newsfeed.concentric.net!news-master!news
From: bradds@concentric.net (Bradd W. Szonye)
Newsgroups: comp.std.c++
Subject: Re: offsetof macro, can it be used in non-trivial classes?
Message-ID: <01bbec82$84753cc0$5974adce@azguard>
Date: 18 Dec 96 01:27:48 GMT
References: <01bbead3$6fbf55f0$c07797cd@hacknowledge>
Organization: Doubleplus Software
Lines: 12
NNTP-Posting-Host: cnc80689.concentric.net
X-Newsreader: Microsoft Internet News 4.70.1155
MC <contem00@cam.org> wrote in article
<01bbead3$6fbf55f0$c07797cd@hacknowledge>...
> How reliable is the offsetof macro when used on a complex class under MI?
It isn't: offsetof() is valid only for POD types. In other words, it can't
be used portably for a class with any kind of inheritance, or many other
new C++ features. If you're using offsetof() on a "real" class, you're
breaking encapsulation anyways, through language abuse.
--
Bradd W. Szonye
bradds@concentric.net
http://www.concentric.net/~bradds
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]