2 ms·
> They modified the type system so good, idiomatic C code won't compile. As someone with 30 years of C experience, maintaining one a 60,000 LOC code base that
by kazinator 8y ago
> They modified the type system so good, idiomatic C code won't compile.
As someone with 30 years of C experience, maintaining one a 60,000 LOC code base that compiles as C and C++, I don't agree, not even slightly.
Each one of the things diagnosed in C++ but not in C is a good idea.
> bizarre octal notation which makes 0100
That would be a serious incompatibility. POSIX code like chmod(file, 0644) stops working. Under no circumstances would it be acceptable to just treat 0644 like 644; it would have to be diagnosed.
Octal notation is so needed here, that if it were removed, programmers would resort to macros like OCT(6,4,4).
What's strange in C is octal character constants, which must be exactly one, two or three octal digits. So \0000 is \000 (same as \0) followed by the literal character 0.
There is no leading zero; there are only octal constants: \123 is octal, not a hundred twenty-three.
- steveklabnik 8y agoRust uses 0o for octal literals, so that you can still have them, but you don't run into the footguns with just a leading 0. It adds a nice symmetry with 0x and 0b (for hex and binary, respectively.)