Date: Wed, 8 Jul 2026 08:48:43 +0200
I don't know what those tables mean.
The test programs print either foo$ or bar$, but the tables
show "foo$ / bar$" (i.e. both) uniformly.
Furthermore, we have already established that there is default behavior
with all compilers, and different behavior using some opt-out command-
line switch. Having these switches documented would be a good first
step.
Jens
On 7/8/26 00:17, Steve Downey via SG16 wrote:
> The un-surprising things is that neither GCC or clang has changed their behavior at all around $ in or near identifiers:
> C++ (-std = c++14 / c++17 / c++20 / c++23 / c++2c)
>
> ┌────────────┬────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐
> │ Compiler │ Ver │ c++14 │ c++17 │ c++20 │ c++23 │ c++2c │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ g++-13 │ 13.3.0 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ — │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ g++-14 │ 14.2.0 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ g++-15 │ 15.2.1 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ g++-16 │ 16.1.1 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang++-18 │ 18.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang++-19 │ 19.1.7 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang++-20 │ 20.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang++-21 │ 21.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang++-22 │ 22.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├────────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang++-23 │ 23.0.0 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> └────────────┴────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
>
> C (-std = c11 / c17 / c2x / c23)
>
> ┌──────────┬────────┬─────────────┬─────────────┬─────────────┬─────────────┐
> │ Compiler │ Ver │ c11 │ c17 │ c2x │ c23 │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ gcc-13 │ 13.3.0 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ — │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ gcc-14 │ 14.2.0 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ gcc-15 │ 15.2.1 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ gcc-16 │ 16.1.1 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang-18 │ 18.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang-19 │ 19.1.7 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang-20 │ 20.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang-21 │ 21.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang-22 │ 22.1.8 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> ├──────────┼────────┼─────────────┼─────────────┼─────────────┼─────────────┤
> │ clang-23 │ 23.0.0 │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │ foo$ / bar$ │
> └──────────┴────────┴─────────────┴─────────────┴─────────────┴─────────────┘
>
> C++:
> #include <cstdio>
> #include <cstring>
>
> #define f(x) #x
> #define g(x) f(x)
> #define foo bar
>
> int main() {
> const char* s = g(foo$);
> std::printf("g(foo$) == \"%s\"\n", s);
>
> if (std::strcmp(s, "foo$") == 0)
> std::puts("=> '$' IS supported in identifiers: foo$ was one identifier.");
> else if (std::strcmp(s, "bar$") == 0)
> std::puts("=> '$' is NOT supported: foo$ became macro foo -> bar, then $.");
> else
> std::puts("=> unexpected");
> }
> C:
> #include <stdio.h>
> #define f(x) #x
> #define g(x) f(x)
> #define foo bar
> int main(void){ printf("%s\n", g(foo$)); return 0; }
>
>
>
Received on 2026-07-08 06:48:47
