Talk:C++ vs. C

From Pin Eight
Jump to: navigation, search

extern template[edit]

"The next C++ standard should include explicit instantiation, but you can't yet count on a C++ compiler to support this."

This isn't quite true - "extern template" is not in the Standard, yes, but it's one of the most widely supported C++ extensions to date, and also historically one of the earliest (it was already supported in VC6 and g++ 3.3). Have a look at this table. 131.107.0.103 16:32, 6 July 2010 (UTC)

Added to article. --Tepples 17:14, 6 July 2010 (UTC)

finally[edit]

"finally" can be done by means of a scope guard, implemented as a library. This was somewhat tedious to do pre-C++0x due to absence of first-class functions. Now that C++0x introduced lambdas, the stock idiom for a scope guard is to use a null shared_ptr<void> with a custom lambda deleter:

   std::shared_ptr<void> guard(nullptr, [&] {
       // finally
       ...
   });
   ...

Of course one can also write their own scope guard class, it's just that shared_ptr is already available. 131.107.0.103 16:39, 6 July 2010 (UTC)

Effective C++[edit]

I have access to what appears to be the first edition of Effective C++. Do you have any need to use this as a reference? Eighty5cacao 15:40, 4 September 2010 (MST)

No thanks. I've been referring to an HTML e-book on CD of Effective C++ (second edition) and More Effective C++. --Tepples 20:29, 4 September 2010 (MST)