csharplang/proposals/csharp-7.2/leading-separator.md
Bill Wagner 8d75920537
update 7.2 proposals for markdown lint concerns (#2316)
Primarily these changes:

1. ATX style headers.
1. `csharp` as the language identifier
1. relative link to other published proposals.
2019-03-07 17:03:44 -05:00

925 B

Allow digit separator after 0b or 0x

In C# 7.2, we extend the set of places that digit separators (the underscore character) can appear in integral literals. Beginning in C# 7.0, separators are permitted between the digits of a literal. Now, in C# 7.2, we also permit digit separators before the first significant digit of a binary or hexadecimal literal, after the prefix.

    123      // permitted in C# 1.0 and later
    1_2_3    // permitted in C# 7.0 and later
    0x1_2_3  // permitted in C# 7.0 and later
    0b101    // binary literals added in C# 7.0
    0b1_0_1  // permitted in C# 7.0 and later

    // in C# 7.2, _ is permitted after the `0x` or `0b`
    0x_1_2   // permitted in C# 7.2 and later
    0b_1_0_1 // permitted in C# 7.2 and later

We do not permit a decimal integer literal to have a leading underscore. A token such as _123 is an identifier.