This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: invalid offsetof from non-POD type


> In C++, the needs for a powerful offsetof is mitigeted by the notion
> of pointer to members.  If we could subtract two pointer to data members
> (or complete that algebraic type, borrowing words from John Skaller)
> then I believe we would not have to reinvent whell anew for making
> offsetof play nicely witg non-PODs.

I had a not too large piece of code which used offset style mechanics, which
I changed over to pointers to members (due to wanting toget rid of said
warning).  The issues I seem to remember getting annoyed at was, the lack of
common type.  Offsetof is just a number.  If you want to store a list of
different offsets, its easy.  With pointers to members, if you want to store
a list of pointers to members, where the targets arent all of the same type,
life gets much uglier.  I'm sure being strongly typed is useful, but a
'generic member pointer' type would seem nice.

I might be completely wrong here, was a while ago.

Gareth


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]