Namespace pollution due to compiler.h in Xenomai 3.1
wd at denx.de
Fri Mar 13 15:12:29 CET 2020
In message <b5fe4180-4d04-3031-6d12-b7c9ccfa22ad at siemens.com> you wrote:
> On 13.03.20 09:18, Richard Weinberger via Xenomai wrote:
> > Hi!
> > Our application uses cobalt/stdio.h, which includes at the end
> > boilerplate/compiler.h.
> > compiler.h defines since 3.1 __packed and other gcc attribute helpers
> > in the global namespace. Is this intended?
> > 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
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.
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
That said, there may be good reasons for what you did beyond obsequi-
ous sycophantic parody. Perhaps you might be so kind as to elucidate.
-- Tom Christiansen in <5ldjbm$jtk$1 at csnews.cs.colorado.edu>
More information about the Xenomai