3 ms·
Potential Flame War Warning I've gotten in several arguments with people about why I like C more than C++, and that's in no small part because I find C to be a
by tombert 8y ago
Potential Flame War Warning
I've gotten in several arguments with people about why I like C more than C++, and that's in no small part because I find C to be a lot simpler than C++. This is an example; I feel you can learn enough C to actually start doing stuff in a 45 page manual, where with C++ I did it for about a year and never really felt I had a real handle on all the idioms.
I know there are probably a lot of objective reasons to why C++ is safer or something, but I've always felt that if you embrace GCC's extensions, and glibc (and use of Boehm's GC for parts that need to be a bit safer), you end up with a language that's simple to learn, and has a lot of the features I actually use in other languages.
That said, this is coming from a very-much-not systems programmer, and I mostly do Lispey stuff nowadays.
- pjmlp 8y ago> I've always felt that if you embrace GCC's extensions, and glibc (and use of Boehm's GC for parts that need to be a bit safer) Which isn't ISO C any longer, rather GCC C.
- tombert 8y agoNo argument there, but how is that radically different than embracing GHC Haskell, Racket, rustc, or Go, or any of the other de-facto compilers for a language? I'm personally not opposed to breaking from ANSI/ISO in regards to using GCC or clang; these platforms are incredibly well-tested and supported, produce fast executables, and work on basically every platform out there.
- pjmlp 8y agoGCC isn't the de-facto compiler for the C language, rather an implementation for ISO C among many others. Contrary to the languages listed by you, there are plenty of compilers across the industry. The computing world isn't composed only of FOSS UNIX clones.
- tombert 8y agoSure, there are a lot of compilers for C, but my point is that I'm happy enough writing GCC C; a large chunk of the nonstandard GCC stuff actually works across other compilers (like clang and Intel), and my point was that I'm happy enough, at least for the work that I do in C occasionally, to limit myself to compilers that support the GCC extensions. Yes, the world isn't composed of FOSS UNIX clones entirely, but GCC works on a lot of platforms now that aren't Unix. MinGW has typically worked fine for me on Windows (not even counting Cygwin or WSL). I don't do systems programming, so I don't know how much (if at all) GCC is used on stuff like micro-controllers. I suppose I didn't make my argument clear enough, but as I said, if you view GCC C as its own language, I don't view that as different than using rustc.
- userbinator 8y agowhere with C++ I did it for about a year and never really felt I had a real handle on all the idioms. With all the Modern C++ changes happening, it seems like the standards committee is actively making it harder for people who want to understand the language completely. I much prefer C to C++ for the same reason, although I think some features from C++ are genuinely useful, like classes.
- tombert 8y agoI found that when I wrote C++, I almost exclusively ended up using features that were already in C; obviously there are no classes in C, but I was happy enough using structs and functions that just take a pointer of that struct type for the first argument.
- Longhanks 8y agoWhich is why the functions in <algorithm> and many more STL headers are just that; templated functions. There's nothing wrong with them. However, modern C++ enables safer and clearer semantics than what raw pointers offer, such as references or smart pointers.