Re:Why You Should Know C++
by kristiandupont on Wednesday May 20, 2009 @01:39PM
(#618932)
"Templates are not used"? Do you mean that you code C++ without the standard library?
Re:Why You Should Know C++
by markessien on Thursday May 21, 2009 @03:51AM
(#620068)
The STL is optional. Templates are widely used in container formats, but in real world programming, for example when people model shopping carts or so, most of the code out there does not use templates. Let's get real here and look at a code repository like codeproject or codeguru - those sites hold diverse examples of real world code - and template usage is minimal.
Templates in C++ are not good, but they are not widely used in the real world.
Depends on where your "real world" is. C++ usages are vendor and library dependent. My C++ code looked different in MFC/COM/ATL than in FLTK and that too was different than Qt. Choosing the right C++ becomes a matter of choosing the right vendor, and if that choice isn't up to you, well, tough luck.
Re:Why You Should Know C++
by stcredzero on Thursday May 21, 2009 @11:27AM
(#620576)
If I were to extend C by adding python style classes on top of it, I would end up with roughly the same number of keywords.
You can use Objective-C as a datapoint here. That's Smalltalk on top of C. You can use the same sort of trick (delimiting the dynamic sends) to recycle the C keywords in the dynamic context, and end up with a language with just a few more keywords than C.
I agree that C++ is very library oriented, and it changes your approach to the language, but this is not a fault of the language itself, this is a side-effect of its very wide popularity.
If you have a pattern used by a library, then that is the fault of the library, but not a fault of the language. The language does not come with any patterns.
Templates in C++ are not good, but they are not widely used in the real world. Most people ignore them, and that's good so.