Namespace pollution due to compiler.h in Xenomai 3.1

Wolfgang Denk wd at denx.de
Fri Mar 13 15:22:48 CET 2020


Hi,

In message <20200313141229.7C87C24003E at gemini.denx.de> I wrote:
>
> > > We noticed because out application also defines __packed...
> >
> > That's indeed bad style which I didn't realize so far. All those 
> > short-hands should be prefixed, e.g. like qt does (Q_NORETURN, Q_LIKELY 
> > etc.).
>
> Was there not a rule in ANSI C that the use of double underscores in
> identifiers is reserved compiler internal definitions?  I would expect
> that it's ok in compiler.h but incorrect in any application headers.

For example C99 section 7.1.3 (see [1]):

        All identifiers that begin with an underscore and either an
        uppercase letter or another underscore are always reserved
        for any use.

[1] https://busybox.net/~landley/c99-draft.html#7.1.3


So IMHO any definition of __packed... in application code is not
standard conforming.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If a train station is a place where a train stops,
                                           then what's a workstation?



More information about the Xenomai mailing list