Sujet : Re: Hex string literals (was Re: C23 thoughts and opinions)
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 18. Jun 2024, 06:39:49
Autres entêtes
Organisation : None to speak of
Message-ID : <87zfrizu56.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Lawrence D'Oliveiro <
ldo@nz.invalid> writes:
On Mon, 17 Jun 2024 17:19:50 -0700, Keith Thompson wrote:
C23 adds the option to use apostrophes as separators in numeric
constants: 123'456'789 or 0xdead'beef, for example. (This is borrowed
from C++.
>
Why not underscores, as supported in both Ada and Python?
And Perl, and probably other languages.
That would have been my preference, but C++ (starting in C++17)
and C (starting in C23) have already specified apostrophes. C++
uses underscores as part of the syntax for user-defined literals,
also introduced in C++17.
The apostrophe is the standard thousands separator in Switzerland.
I don't know how much that influenced the decision in C++.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */