bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnulib] Re: include-once-only macros


From: Simon Josefsson
Subject: [Bug-gnulib] Re: include-once-only macros
Date: Tue, 28 Sep 2004 16:23:35 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Simon Josefsson wrote:
>>      * minmax.h: Replace _MINMAX_H with MINMAX_H.
>
> Why do you do that?

I thought that POSIX (or C99?) implied user code shouldn't use CPP
symbols that began with '_'?  The Libtool manual says:

   Note that the `#ifndef FOO_H' prevents the body of `foo.h' from
   being read more than once in a given compilation.
...
   (1) We used to recommend `__P', `__BEGIN_DECLS' and `__END_DECLS'.
   This was bad advice since symbols (even preprocessor macro names) that
   begin with an underscore are reserved for the use of the compiler.

Is that only true for _two_ leading underscore?

> I've been using the _XYZ_H naming scheme for years,
> and never got a problem with it. Whereas, on the other hand, identifiers
> that are not prefixed with underscores give collisions more often than
> you think:
>   DS            /* SVR4, Solaris */
>   SP            /* SVR4, Solaris */
>   EAX           /* SVR4, Solaris */
>   CBLOCK        /* 386BSD */
>   hz            /* AIX */
>   TIME_ABSOLUTE /* MacOS X */
>   TIME_RELATIVE /* MacOS X */

I'm not sure I follow.  Does, for example, SVR4/Solaris then define
DS_H?  I guess symbols like *_H would occur less natural.

I don't care much, but I have started to use non-underscore CPP
symbols consistently.  My pedantic (fascistic?) part of me then
automatically wants to fix any uses of underscore I discover.  I'm
sorry it distracted the real discussion (although this distraction can
be enlightening).

Thanks,
Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]