Sujet : Re: "A diagram of C23 basic types"
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 08. May 2025, 17:32:10
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250508092354.556@kylheku.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2025-05-08, Scott Lurndal <
scott@slp53.sl.home> wrote:
I recall running into issues using variables named 'index'
when porting code to SVR4 when the BSD compatibility layer
was present.
I've also run into issues with clashes with BSD-specific
functions on those systems.
It's because the BSD people refuse to understand how feature selection
macros are supposed to work.
In BSD toolchains, if you don't specify any -D_WHATEVER=BLAH feature
selection macro, then all identifiers are visible.
When when features are specified, they *restrict* visibility.
When you specify -D_FOO and -D_BAR, you get the *intersection*
of FOO and BAR.
That includes compiler dialect selection options. Under BSDs,
if you specify, say, "-ansi" on your command line, you are
not only getting a certain dialect from the compiler, but
the BSD header files like <stdio.h> will hide POSIX functions
like fdopen, even if you have a POSIX macro like -D_POSIX_SOURCE.
The intersection of ANSI and POSIX does not contain fdopen.
So what ends up happening on BSDs is that you end up revealing
more identifiers than you need, which exposes clashes.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca