4 ms·
> Another big incompatibility with C and C++ is that C++ is actually incompatible with K&R syntax Why in the world would you use K&R syntax to demonstrate the
by _gabe_ 3y ago
> Another big incompatibility with C and C++ is that C++ is actually incompatible with K&R syntax
Why in the world would you use K&R syntax to demonstrate the differences between C and C++? Some of the most readable C code I've looked at has to be Sean Barett's single header files. And he sure doesn't use K&R syntax, and for good reason. Why not show something much simpler? Like the fact that you don't need to typedef a struct to use it without adding the structure keyword to the type like you do in C?
> Lots of Suckless users and developers only use C and POSIX shell in their programs. Cat-v endorses C and C-like languages, but despises C++. Even Linus Torvalds, the creator Linux and Git, won’t touch C++. Heck, even I love C but I can’t stand programming in C++
Ok man, you can gatekeep all you want. You know what's funny? Games are probably one of the quintessential examples of software that requires the performance of C or C++. And you know what the most sold game of all time is? Oh yea, Minecraft, written in Java. I'm sure that makes you shudder. And you know what? I'm glad Notch didn't listen to a bunch of gatekeepers and wrote it in a language he knew and could use and blessed the world with this amazing game.
Also, some people just don't hate themselves. They're not too hard core to realize that C has some very real flaws, but may still appreciate the simplicity of C. Those programmers may program in C++ in a style very close to C, but with the additional benefit of generic programming for type safe containers instead of a bunch of hideous macro magic that's bound to bite you in the ass very quickly. And you know what? There's nothing wrong with that either.
The funny thing is, I agree with the title of this article, but the whole tone is just gross. I'm so sick of gatekeepers ruining programming for newcomers and old timers alike. In the true spirit of being a hacker, quit being so anal and let people just code and kindly correct them if they spread a misnomer like the idea that C and C++ are 100% equivalent.
- Narishma 3y agoAnd wasn't K&R function definition syntax removed in the latest C standard anyway?
- _gabe_ 3y agoIt looks like it was, I wasn't aware of that :) It also looks like it's been deprecated since C89 and the use of the style has also been discouraged since then according to this article[0]. > At the time, they felt they could not remove the K&R “old-style” definitions. It had not been deprecated long enough, and the new syntax had not been around for long enough (it hadn’t been around at all, in fact). So, they rolled it into C89 deprecated, and explicitly discouraged its use for some 33+ years. [0]: https://thephd.dev/ever-closer-c23-improvements#at-the-time-they-felt-they-could-not-remove-the-k-r-%E2%80%9Cold-style%E2%80%9D https://thephd.dev/ever-closer-c23-improvements#at-the-time-...
- eesmith 3y ago> the most sold game of all time is Now what's the most distributed game? I'm pretty sure Microsoft Solitaire was on more machines than Minecraft. ;)