Skip to content

Instantly share code, notes, and snippets.

@d3x0r
Last active March 5, 2020 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d3x0r/93f8da65f79de66a9736754fdfd99f54 to your computer and use it in GitHub Desktop.
Save d3x0r/93f8da65f79de66a9736754fdfd99f54 to your computer and use it in GitHub Desktop.
C Proposal - Allow underscores in numbers
Document number Nnnnn=yy-nnnn
Date: yyyy-mm-dd
Project Programming Language C++, Library Working Group
Reply-to this document

I. Table of Contents

II. Introduction

  • Allow _ in numbers as non-breaking-zero-width-space (or otherwise ignored when gathering a number) 1_123.000_000_001 allowing them anywhere after a number token starts (0-9, -(?), +(?)). The _ are not retained as part of the number, and no printing will restore them other than custom user routines. Nearly all other languages now support this.
  • ECMA SCRIPT proposal Has references to other languages' implementation.

III. Motivation and Scope

  • Adds convenience feature for coding numbers. 0x33_45_33_42 for example.

IV. Impact On the Standard

  • All valid code previously written still behaves the same way.

V. Design Decisions

  • See ECMA Proprosal for more information.

VI. Technical Specifications

  • None Provided

VII. Acknowledgements

  • None known, no previous proposals have been mentioned.

VIII. References

Allow underscore in numbers for formatting

Allow _ in numbers as non-breaking-zero-width-space (or otherwise ignored when gathering a number) 1_123.000_000_001 allowing them anywhere after a number token starts (0-9, -(?), +(?)). The _ are not retained as part of the number, and no printing will restore them other than custom user routines.

Nearly all other languages now support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment