4 ms·
Linus was a hypocritical asshole here, but more to the point, why are they using strings for this anyway? No byte arrays / literals in their C dialect?
by Philpax 2y ago
Linus was a hypocritical asshole here, but more to the point, why are they using strings for this anyway? No byte arrays / literals in their C dialect?
- xnorswap 2y agoMy layman understanding is that it's the other way around, C doesn't have a string type. Since C doesn't have a string type, "quoted strings" are actually char[] but with '\0' as an extra last character. People have therefore made warnings happen when defining a char[] which silently truncates the '\0', because that's a common source of bugs. They've then had to develop a way of easily disabling that warning from being generated, because it's also common enough to want to avoid the warning. All of this seems insane coming from a modern language. But look at the complete disaster that was the Python 2 -> 3 migration, a large motivator for which was "fixing" strings from a non-unicode to unicode compatible type. A decade or more of lost productivity as people struggled to migrate. There's no way to actually fix C. Just keep recommending that people don't use it.
- Philpax 2y agoYep, agreed on all accounts; I'm an advocate for Rust for Linux for these reasons, among others. My thinking was that the Linux kernel already uses a custom dialect of C with specific features that benefit their workflow; I'm surprised that one of those features wasn't a char[] charset = b"abcdefghijklmnopqrstuvwxyz"; that would allow for intent to be signalled to the compiler.
- surajrmal 2y agoRust for Linux still uses null terminated strings for comparability.