5 ms·
> C++ apparently wants to separate 1 from 2 and 3, to move more high-level and get more "language magic" (templates, iteration stuff... ) without making the lan
by danra 8y ago
> C++ apparently wants to separate 1 from 2 and 3, to move more high-level and get more "language magic" (templates, iteration stuff... ) without making the language any safer in any respect.
How so? Take std::unique_ptr for example, which exists since C++11. It facilitates using the language in a safer manner, and at a higher level of abstraction (you no longer have to manually malloc and free/new and delete - you just have the concept of scoped ownership), while at the same time not adding any “behind the scenes” magic (e.g. garbage collection) so as not to leave room for any high-level language to be more performant than it is - that’s the real motto of C++, to my understanding.
- msla 8y ago> while at the same time not adding any “behind the scenes” magic (e.g. garbage collection) Stuff the compiler does statically is still magic. Anything which makes it more difficult to see the assembly language through the code is magic.
- msla 8y agoIt seems odd that this comment, of all of the ones I've made, is getting downvoted. Did I break a taboo? Am I not supposed to notice that the + operator in C++ programs can represent vastly different amounts of CPU work and memory usage in different contexts? Or that RAII does substantial amounts of work which is hidden from the source code? Seems like magic is magic regardless of whether it happens at compile time or runtime.