3 ms·
Following that argument, C allows as much control, with fewer gotchas.
by AceJohnny2 13y ago
Following that argument, C allows as much control, with fewer gotchas.
- mpyne 13y agoMore "gotchas" actually, from the secure coding perspective. C is nicer in that its ABI is so simple that it's practically the lingua franca of inter-language linkage, but the fact that pointer types convert automatically to other pointer types is a huge source of errors, and so is the lack of language support for things like destructors. Additionally there are many C++ concepts that cannot be implemented in C without the use of macros everywhere, such as using a sorting algorithm (which in C requires either a pointer indirection for a function call, or use of macros to generate a new sort function for each appropriate type). Additionally in C++ you can use things like type expressions to select and compile the optimal version of a matrix-vector multiplication automatically, and I'm not even sure you could do that in C with macros as it involves programmatically generating types at compile-time. C is certainly nice for some problems but your comment applies as much to going from C to asm as it does going from C++ to C.
- codex 13y agoAnd assembly language even more control than C, with even fewer gotchas. However, C++ occupies a sweet spot whereby it allows a lot of control, but also a lot of abstraction and structure--much more so than C, in my opinion. Or, put another way: one doesn't build a skyscraper out of playdough or cinderblock (easy to use materials), but one doesn't mill the entire skyscraper out of a solid block of steel, either (that would be unjustifiably difficult). C++ is the language of skyscrapers.
- comex 13y agoAs a data point, I would like to see a language much more like C than like C++ (including, somewhat but not entirely idiosyncratically for me, no classes), but with templates and some other improvements.
- pux0r3 13y agoMy ideal language is C but with C++ templates, better type safety (no implicit casting to void*), and with a smarter "include" system (ie: something that isn't just copy/paste one source file into another. Although it would be nice to be able to keep #include as well)
- bnolsen 13y agoi suspect something like "clay" would float your boat but I haven't followed it for more than a year now.