[systemd-devel] [PATCH] use #pragma once instead of foo*foo #define guards
Lennart Poettering
lennart at poettering.net
Wed Jul 18 03:39:38 PDT 2012
On Tue, 17.07.12 17:14, Shawn Landden (shawnlandden at gmail.com) wrote:
> #pragma once has been "un-deprecated" in gcc since 3.3, and is widely supported
> in other compilers.
>
> I've been using and maintaining (rebasing) this patch for a while now, as
> it annoyed me to see #ifndef fooblahfoo, etc all over the place,
> almost arrogant about the annoyance of having to define all these names to
> perform a commen but neccicary functionality, when a completely superior
> alternative exists.
>
> I havn't sent it till now, cause its kindof a style change, and it is bad
> voodoo to mess with style that has been established by more established
> editors. So feel free to lambast me as a crazy bafoon.
> ---
> src/systemd/sd-daemon.h | 5 +----
> src/systemd/sd-id128.h | 5 +----
> src/systemd/sd-journal.h | 5 +----
> src/systemd/sd-login.h | 5 +----
> src/systemd/sd-messages.h | 5 +----
> src/systemd/sd-readahead.h | 5 +----
> 101 files changed, 101 insertions(+), 403 deletions(-)
Hmm, so I am not completely opposed to this (though I also don't see the
big benefit). But before we merge anything like this: I think the
externally visible headers (i.e. the ones above) should really continue
to use the classic #ifdef guards. For the externally used headers we
should try hard to make them as "compatible" as we can. That includes
the C++ external foo, but also not using any fancy C99 features or
#pragmas.
Kay, Michal, do you have any strong opinion on this?
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list