This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/13275] [3.4 regression] Implementation of offsetof macro
- From: "gdr at integrable-solutions dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Dec 2003 09:53:32 -0000
- Subject: [Bug c++/13275] [3.4 regression] Implementation of offsetof macro
- References: <20031203003343.13275.jbrandmeyer@earthlink.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at integrable-solutions dot net 2003-12-03 09:53 -------
Subject: Re: [3.4 regression] Implementation of offsetof macro
"nathan at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| I have come to the conclusion that one *cannot* implement offsetof without
| a builtin of some kind. You need something like
| #define offsetof(type,member) \
| __builtin_offsetof (__builtin_offset_obj(type).member)
| You need cooperation from the parser, so that the .MEMBER part is
| looked up in the context of TYPE - hence the __builtin_offset_obj part.
wouldn't __offsetof__(type, member_name) suffice? The first argument
would provide the type (for the context). That is, I would like to
understand why we need the xxx_obj built-in.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13275