From: Jamie Lokier <jamie@shareable.org>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [5466] Only use __builtin_* with GCC >= 3.4
Date: Sun, 12 Oct 2008 16:33:39 +0100 [thread overview]
Message-ID: <20081012153339.GC18814@shareable.org> (raw)
In-Reply-To: <48F21193.3000809@redhat.com>
Avi Kivity wrote:
> It's illegal to define or use an identifier beginning with two
> underscores, unless it's documented by the implementation. What if
> glibc adds a third argument? All your apps wil break.
>
> You should define your own macros for this, with a non-__ name.
I agree. Portable apps especially should use their own names.
Same applies with just one underscore, I think: they're reserved in
the "implementation" namespace.
But I'd add that avoiding underscore is advisable but not a guarantee.
Sometimes Glibc defines a new macro/variable/function _without_ the
preceding underscore, when you've requested all Glibc extensions by
defining _GNU_SOURCE. It's not likely for this macro, and conflicts
are obviously much more likely with underscore prefixes.
I've also seen ugly link-time or run-time errors: E.g. defining a
function called `dprintf' or `warn' in the app can break some parts of
Glibc at run-time, with no compile-time error.
This is awkward for third party _libs_ used with a lot of other libs
and apps, as the only realistic protection comes from making sure
every non-static symbol (including internal-use-only ones) has a
prefix that no other lib or app is likely to use. Fingers crossed.
Once you're dependent on prefix uniqueness, it's a matter of debate or
maybe taste whether using `_myownlib_symbol' (i.e. underscore prefix
before unique prefix) is advisable for internal-use-only names.
-- Jamie
next prev parent reply other threads:[~2008-10-12 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-12 11:44 [Qemu-devel] [5466] Only use __builtin_* with GCC >= 3.4 Aurelien Jarno
2008-10-12 12:33 ` Avi Kivity
2008-10-12 14:23 ` Jamie Lokier
2008-10-12 15:02 ` Avi Kivity
2008-10-12 15:33 ` Jamie Lokier [this message]
2008-10-12 19:10 ` M. Warner Losh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081012153339.GC18814@shareable.org \
--to=jamie@shareable.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.