Linux Manual Pages development
 help / color / mirror / Atom feed
* _ISOCxx_SOURCE
@ 2026-06-13 12:02 Alejandro Colomar
  2026-06-15 17:20 ` _ISOCxx_SOURCE Joseph Myers
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar @ 2026-06-13 12:02 UTC (permalink / raw)
  To: libc-alpha; +Cc: gcc, linux-man

[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]

Hi!

I was reviewing the feature_test_macros(7) page, and found the
documentation of the _ISOC{99,11,23,...}_SOURCE macros to be incorrect.
And thinking about fixing that led me to think that the design of those
macros is less than ideal.

Here's for example some of the problematic text:

        Defining _ISOC23_SOURCE also enables C11, C99, and C95 features.

The above is not true.  See for example some contradicting (and also
incorrect/incomplete) text in the HISTORY section of gets(3):

	glibc header files don’t expose the function declaration if the
	_ISOC11_SOURCE feature test macro is defined.

gets(3) is a C89 and C99 feature, which is disabled with C11 and later
standard versions.  The text saying that _ISOC23_SOURCE enables older
features is only true as much as those features remain in the C23
standard.  And in gets(3), we should say that the function is not
exposed on C11 or later (not just C11).

A better design of this macro would be to have a single identifier, and
use a value to specify the version.  This is how POSIX does it.  We
could call it _ISO_C_SOURCE, and have a value such as 202311L for
requesting C23.  That would make it easier to describe: features are
available within a range of versions; often a half-bounded interval,
starting at a version, and not ending; but other times a bounded
interval, starting at a version, and ending at another version.

What do you think?


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: _ISOCxx_SOURCE
  2026-06-13 12:02 _ISOCxx_SOURCE Alejandro Colomar
@ 2026-06-15 17:20 ` Joseph Myers
  2026-06-15 21:06   ` _ISOCxx_SOURCE Alejandro Colomar
  0 siblings, 1 reply; 3+ messages in thread
From: Joseph Myers @ 2026-06-15 17:20 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: libc-alpha, gcc, linux-man

On Sat, 13 Jun 2026, Alejandro Colomar via Gcc wrote:

> I was reviewing the feature_test_macros(7) page, and found the
> documentation of the _ISOC{99,11,23,...}_SOURCE macros to be incorrect.
> And thinking about fixing that led me to think that the design of those
> macros is less than ideal.

Users should normally use -std= options with the compiler to get matching 
language and library features.  These feature test macros are mainly for 
niche cases with old compilers.  So I don't think any new user-facing 
design for them should be added (the C23 and later ones already use the 
newer __GLIBC_USE style of conditionals in the header implementation).

-- 
Joseph S. Myers
josmyers@redhat.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: _ISOCxx_SOURCE
  2026-06-15 17:20 ` _ISOCxx_SOURCE Joseph Myers
@ 2026-06-15 21:06   ` Alejandro Colomar
  0 siblings, 0 replies; 3+ messages in thread
From: Alejandro Colomar @ 2026-06-15 21:06 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha, gcc, linux-man

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

Hi Joseph,

On 2026-06-15T17:20:17+0000, Joseph Myers wrote:
> On Sat, 13 Jun 2026, Alejandro Colomar via Gcc wrote:
> 
> > I was reviewing the feature_test_macros(7) page, and found the
> > documentation of the _ISOC{99,11,23,...}_SOURCE macros to be incorrect.
> > And thinking about fixing that led me to think that the design of those
> > macros is less than ideal.
> 
> Users should normally use -std= options with the compiler to get matching 
> language and library features.  These feature test macros are mainly for 
> niche cases with old compilers.  So I don't think any new user-facing 
> design for them should be added (the C23 and later ones already use the 
> newer __GLIBC_USE style of conditionals in the header implementation).

Makes sense.  Should I document that users should avoid setting them
directly (and that they should use the corresponding compiler flag)?


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-15 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-13 12:02 _ISOCxx_SOURCE Alejandro Colomar
2026-06-15 17:20 ` _ISOCxx_SOURCE Joseph Myers
2026-06-15 21:06   ` _ISOCxx_SOURCE Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox