4 ms·
I think "nearly a superset" is correct, the empty argument list doesn't really make enough of a difference to really make it a completely different language. I
by simias 6y ago
I think "nearly a superset" is correct, the empty argument list doesn't really make enough of a difference to really make it a completely different language. I also don't think I've ever seen this "feature" of C used productively in modern codebases, except maybe to declare generic function pointers in something like dlfunc. In general it's just that people are too lazy to type `void func(void)` (or don't know the difference).
You can also tell that the C++ standard committee agrees with this to some extent since they tend to add C novelties into the C++ standards whenever possible to make it easier to write compatible code, for instance: https://en.wikipedia.org/wiki/C%2B%2B11#Improved_C_compatibility https://en.wikipedia.org/wiki/C%2B%2B11#Improved_C_compatibi...
- Gibbon1 6y agoI feel like treating C as a subset of C++ has done real harm to the language.
- rrdharan 6y agoWhich one?
- Gibbon1 6y agoNo arrays, no real strings. Pushing UB issues on the programmer instead of forcing the compiler maintainers to deal. No closures. Threading as a first class construct. No modules. Standard Library is increasingly a bad joke. What's happened is the direct opposite of C++ where every fad gets added to the language. With C lots of standard proven features don't make it into the language.
- rrdharan 6y agoHeh, yeah my point was you could plausibly apply your statement to both languages, i.e. their confusing coupling impedes both in different ways.
- simias 6y agoI agree that teaching C++ as "C and then some stuff on top" is probably a bad idea. But I also think that it's not technically incorrect to say that "C is mostly a subset of C++", at least as far as most C constructs will work in C++ with only minor tweaks. It's a bit like saying that operating the windscreen wipers is a subset of knowing how to drive a car. It's strictly correct, but it's probably not where you should start nor where you should put most of your attention if you're looking to get you license.
- loeg 6y agoStandard C++ still lacks C99 compound literals, doesn't it? That's the biggest gap I've run into. It is a common and practical construct in C.