[Bug 1941] Whither RTEMS_offsetof?
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Thu Oct 20 11:44:53 UTC 2011
https://www.rtems.org/bugzilla/show_bug.cgi?id=1941
--- Comment #4 from Ralf Corsepius <ralf.corsepius at rtems.org> 2011-10-20 06:44:52 CDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > We should implement it in terms of what the C standard provides <stddef.h>:
> > >
> > > http://pubs.opengroup.org/onlinepubs/009604499/basedefs/stddef.h.html
> >
> > I don't understand, what you are trying to say.
>
> I would do this:
>
> #include <stddef.h>
>
> #define RTEMS_offsetof(type, member) offsetof(type, member)
Why? There is only _one_ (easily avoidable) use-case in RTEMS.
> > GCC's offsetof is compliant to C99/POSIX => RTEMS_offsetof is meaningless and
> > an potential faulty anachronism.
>
> I would avoid the direct usage of the GCC offsetof builtin.
This doesn't doesn't matter - offsetof is standardized, so people should use
it.
The fact GCC supplies it (similarly to many other dozens of standardized
functions), is an implementation detail, which should not be of interest to
anybody.
> Was RTEMS_offsetof intended for internal use or part of a public API?
It currently is part of a public header, so independently of the intentions, it
was a public API. This means, we can not remove it from RTEMS < 4.11, and have
to stay bugward-compatible there, but we can remove it from RTEMS HEAD.
--
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the bugs
mailing list