4 ms·
Looks cursed to me. But TIL dollar sign $ is also valid character for identifiers.
by hsfzxjy 1y ago
Looks cursed to me.
But TIL dollar sign $ is also valid character for identifiers.
- tempodox 1y ago> $ is also valid character for identifiers. Has been like that in C since forever.
- skullt 1y agoIt's a common extension but it's not standard. Both C23 and C++23 only allow identifiers to start with a Unicode XID_START character, which excludes $. And with older standards, it was just Latin letters, the underscore, and explicit \u escapes. If you look in the project's pedantic.cmake, you'll find a add_c_and_cxx_compile_options("-Wno-dollar-in-identifier-extension") just to suppress warnings about this.
- deleted 1y ago[deleted]
- ksherlock 1y agoVMS used $ - eg sts = sys$getjpiw(0, 0, 0, &jpi_itm_lst, 0, 0, 0); if ((sts & STS$M_SEVERITY) != STS$K_SUCCESS) That might be why GCC originally included $ support.