Subj : Re: Compiler and an interpreter To : comp.programming From : Rob Thorpe Date : Mon Aug 01 2005 09:08 am Gerry Quinn wrote: > In article <42ecc57f$0$2849$ed2619ec@ptn-nntp-reader01.plus.net>, > usenet@jdh30.plus.com says... > > Gerry Quinn wrote: > > > In article <42eb8672$0$14673$ed2619ec@ptn-nntp-reader02.plus.net>, > > > usenet@jdh30.plus.com says... > > >> C++ isn't worth using unless you use the STL, IMHO. Error messages from > > >> all of the compilers that I have seen are completely unwieldy when using > > >> the STL. For example, the following code contains an extra "const": > > > > > > STL is just a library. I got on well enough with the MFC collection > > > classes for a while, although I do prefer STL now. I still use MFC > > > CString. The rest of the stuff is just functions you might need once > > > in a while. > > > > > > [STL example - I'm not sure I would call it C++] > > > > I don't think there's any question that it is C++. If you write code that > > uses the more advanced features of C++ then you'll get many such errors > > (and probably even compiler errors). > > Then you probably shouldn't, unless you need to. > > It seems to me that the much maligned folk who "write C in C++" abuse > the language less than those who try to write Lisp etc. in it! What Jon's written I can't entirely understand, except that he's using many of the most complex features of C++ at once. It isn't really Lisp written in C++, this would be done differently in Lisp. It depends very much on your point of view whether the code Jon posted is idiomatic C++. A lot of people know C++, but only know some areas of the language. Often different programmers know different areas of the C++ language and write in different dialects of it. As far as I can tell there aren't many norms amongst C++ programmers for what idiomatic C++ is. Some programmers use classes and the STL and steer clear of everything else. Stroustrup treats C++ as a multi-paradigm language, where it is idiomatic/conventional to use the best/most concise paradigm for expressing what you're doing. By this measure what Jon wrote probably is idiomatic. Personally, I don't think it's very pleasant though, I'd rewrite it in a simpler way even if it required more code. .