4 ms·
I mostly live in C++ land and the story is different there. The standard library implementations are a place of magick, mystery, and obscure defect reports. The
by pmr_ 13y ago
I mostly live in C++ land and the story is different there. The standard library implementations are a place of magick, mystery, and obscure defect reports. They provide plenty of insight what can go wrong if you are writing a generic library and how difficult correctly programming with templates actually is, but all the technicalities of the language make it hard to see the algorithms. They are definitely worth reading, but only if you have mastered a large amount of C++.
Not to mention the horrible naming conventions (leading double underscores everywhere).
I often think about a C++ standard library written for educational purposes with proper naming, focus on readability instead of optimization, and maybe multiple possible implementations of certain specs.
- maaku 13y agoNo one would use it. It's a design flaw of C++ that performant, generic libraries require arcane magic and hideously obfuscated code.
- pmr_ 13y agoPlease read carefully: "for educational purposes". I'm fully aware that such a library wouldn't be fit for production but it maybe would be useful for people learning generic C++ programming. Currently you have to look at Boost or any of the standard libraries and all you see are #ifdef and all the arcana and have a hard time seeing all the useful techniques.
- maaku 13y agoWhat I meant was: no one would use it, so it'll never be created.
- saurik 13y agoWhen the AP curriculum was in C++ there was, in fact, such a pedogigical version of the library used in classes. (I took AP CS the first year it was in C++.) http://apcentral.collegeboard.com/apc/members/courses/teachers_corner/9259.html http://apcentral.collegeboard.com/apc/members/courses/teache...
- eonil 13y agoIt would make sense to write an easier wrapper around current C++ standard library. Because C++ provides very strong inlining, just simple wrapping with better method names will not make any performance hit. But IMO, naming is one of the hardest work.
- davvid 13y agoLeading double underscore is reserved for the implementation (of the standard library). http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html http://www.gnu.org/software/libc/manual/html_node/Reserved-N...
- pmr_ 13y agoI'm perfectly aware of that. I was just saying that it doesn't aid readability of the code (rather the opposite). There even have been proposals to solve this problem (scoped macros being just one of them) so this is acknowledged to be a rather real problem instead of just some cosmetic issue.
- alextingle 13y agoI always found the C++ standard library relatively readable. It's inspiring just how short many of the functions are.