News for hackers. Stuff that matters.
Re:Has C++ jumped the shark? by wvenable on Monday March 28, 2011 @04:01PM (#2379821)
C++ takes a very simplistic view of runtime performance, however. Generics are implemented using templates; which instantiates the code for every type you use. Naively, this preserves the performance of simply writing the same code for each type (which is what you did before templates). However, that might not be the best performing way to implement generics at runtime.

(Edit: Small change to make meaning clearer)

Re:Has C++ jumped the shark? by johnny531 on Monday March 28, 2011 @04:18PM (#2379890)
Huh? Templates in C++ are pay-for-what-you-use; only those instantiations required by your code are generated.

Note also the ability to extern templates added in C++0x, which allow you to collapse common instantiations to a single object file.

Re:Has C++ jumped the shark? by seabee on Monday March 28, 2011 @04:52PM (#2380039)
How do those features impact runtime performance?

One example of templates affecting runtime performance is poor use of the instruction cache due to code duplication in every instantiation of a template.

Re:Has C++ jumped the shark? by corysama on Monday March 28, 2011 @05:22PM (#2380159)
If you are instantiating equivalent functions (sorting foo* vs sorting bar* ) then the linker will merge their binaries -no dupes there. If you are generating different functions (sorting foo vs foo* ) then you are asking for different functions -no dupes there either. If you want to keep everything down to one function, qsort() didn't disappear when they added std::sort() and it is pretty close to what a dynamic language sort would do under the hood.
Re:Has C++ jumped the shark? by iam on Tuesday March 29, 2011 @04:16PM (#2384213)
I believe this is called Identical COMDAT Folding in VC++
Re:Has C++ jumped the shark? by froydnj on Monday March 28, 2011 @09:10PM (#2380893)
Some linkers do what you describe. Not all.
Re:Has C++ jumped the shark? by lanstein on Monday March 28, 2011 @05:34PM (#2380204)
C++0B maybe?