_ISOCxx_SOURCE

Alejandro Colomar <[email protected]> Sat, 13 Jun 2026 14:02:18 +0200
Newsgroups org.kernel.vger.linux-man
Message-ID <ai1DVieT3gTr4J5S@devuan>
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>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmotRsQACgkQ64mZXMKQ
wqmyKRAAjt/g5B2VJNMc3D1yM4ymQpFS/0rCIKZZQOSNhXk3cO8BlY0OKYQfbfU4
7d0lsCukPxdgwjy7EawuOOgkCjhQzIZ/idgN5UmZ6cSzu/ByWO8GObDgCjwk6eNS
rs9Nt3OL13XRldSh/mWdo6GoUZ6AC3khHKhrzMJpYRte3lX+e2IX1o7EpDoOZqo1
4+EHsqRsBHQwbP5TQywJaHyGwaEj4rFKNivhBg9COSloJ0MC7sDbRWcLC6gD2NkE
3Ur6lbiNIRAjgB9or0snNFtiu63tQgELnvbzDijxFSL776yAyEZKFPKkf2iQAeJg
NFkVFwMnM1m3YlH45GkGEL+z9qWD/oclzj/hNtOuA2gv0YMrG+wa2WkF7yK4txPf
2OXWMBKCHNhNpoTwBFzUFwR3qqcGK4ESfQ2tNT/p5BmEC/s0sAczK/IMrRUcGibY
gzCjisKX9vS8RASSQTo5+8NZaj4nv3c6TwqmLhzvgrOkU5VU3qT+ohl4C+2vcHBm
wAa8j6DiR5NDUgNGe3XR+eHSMo7QXYhmkvbj7BKGxlRvF4HUcSqzixwKNCdw/cHI
RBrJBOsLpnPv9Po8b/d1L8t+2+ef0myN9AUN51Ck/gZZjHw3H4heqZNzIxrc7Ohc
3a7+ndtAsYsI31Uami/3w2slrBWulsCHdtFH1NUQkOm48+WtMGA=
=UoD2
-----END PGP SIGNATURE-----