3 ms·
This is very well-intended, but it suffers from both lots of formatting errors and pure factual ones. It makes my highly conditioned (from Stack Overflow) C lec
by unwind 13y ago
This is very well-intended, but it suffers from both lots of formatting errors and pure factual ones. It makes my highly conditioned (from Stack Overflow) C lecturing mode almost auto-trigger.
It's way too long to do a rebuttal here, though.
Some problems:
- Bad terminology ("C has no object", when in fact the term really is very useful in C even though it probably doesn't mean what you expect if you come from C++ or Python)
- "Booleans don't exist", I don't understand how the author can both acknowledge C99 and say this. Booleans do exist! Their name is not so user-friendly, unless you include stdbool.h, then you get bool, true and false.
- Pure random errors, like the first structure example code ("struct point foo={x: 5, y: 4};", what are those colons and numbers doing there?!)
And so on.
- ethomson 13y ago> Null terminated strings also don't allow us to use multibyte encodings such as utf-8. This just makes me cry.
- dllthomas 13y agoBecause it is unfortunate or because it is incorrect?
- ethomson 13y agoI admit that it's certainly technically correct that you cannot embed a U+0000 into UTF-8. Of course, anybody who actually needed to be able to represent U+0000 in a C string would simply represent U+0000 as 0xC0 0x80 and be done with it.
- dllthomas 13y agoHeh, I wasn't calling you out, I was curious - I've done a little work with multibyte strings in C but never UTF-8, and it's been a very long time, so I didn't remember enough of the details to be sure of which you were saying.
- DerekL 13y agoBut ASCII null-terminated strings can't contain null either, so I don't know why he says that it's just a problem for UTF-8. Also, if you represent U+0000 by 0xC0 0x80, then it's "Modified UTF-8", and it's not valid UTF-8.
- dllthomas 13y agoThe last is not an error, it's simply outdated: http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html These days, you should spell it: struct point foo = { .x = 5, .y = 4 };
- Herdinger 13y agoAs for booleans I don't consider macros and further macros which are part of the library as a datatype, but yes of course they are in the core language. What I wanted to express was that booleans are nothing more than integers with sugar sprinkled over the top. You're right.