C++ Logo

std-proposals

Advanced search

Re: C - Allow underscores in numberic constants

From: Barry Revzin <barry.revzin_at_[hidden]>
Date: Wed, 4 Mar 2020 21:43:53 -0600
On Wed, Mar 4, 2020 at 6:28 PM J Decker via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Allow '_' to be found in a number token, and ignored for generating the
> resulting token. Allow specifying numbers with underscores like
> 0x1234_5678; 123_534.000_003 ; can include trailing underscores, and just
> terminate on the next whitespace or operator...
>
> This is the proposal that was applied for ECMA Script
> https://github.com/tc39/proposal-numeric-separator
>
> This is my Proposal
> https://gist.github.com/d3x0r/93f8da65f79de66a9736754fdfd99f54
>
> J
>

In case anyone is curious, the original digit separators proposal did use
underscores:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2281.html
A subsequent draft included a whole bunch of different options:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3499.html
Before going back to underscore:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3661.html
and finally the single quote we've had since C++14:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf

Barry

Received on 2020-03-04 21:46:44