lucasart wrote:Rein Halbersma wrote:Just pointing to a FAQ of corner cases does not mean that the fast majority of template libraries is not enormously useful.
You obviously have not read any of this FAQ. These are not corner cases. I've experienced many of them already. And this is just the template part. There is an entire FAQ/FQA on C++. You should seriously read some of it, as it would open your mind a little bit.
This guys knows the arcanes of C++ better than anyone here, perhaps even you. But, unlike C++ evangelists, he speaks from experience rather than theory, and he also knows a *lot* of other programming languages, so his brain did not rot from years of thinking that C++ is the only right way to do things.
When I first came across that FQA Lite (around a decade ago?) I was still a big fan of C++. "What is this guy talking about?" I thought to myself. "He's comparing it to interpreted languages with garbage collectors, that's not fair." I thought. "Of course it doesn't provide run-time type safety, its a compiled language!" I thought.
But then I used C++ for more years, and I eventually came to realize that
I now agree with everything in that FQA Lite. Most of the criticisms are spot-on, and many annoying things about the language and about its actual implementations (such as long compile/link times, undecidable grammar of the language, etc.) are covered in there. The lack of a proper module system means large C++ programs can take
orders of magnitude longer to compile than equivalent-sized programs in a language such as Java, C# or D (or Modula-3 or Ada or ...) The conscious lack of a garbage collector, makes exceptions very tedious to use (and the reluctance of the standards committee to enshrine a "magic" class such as "std::throwable" or something, as the base of all exceptions, makes its pretty much impossible to catch and sensibly handle all of the things that might be thrown.) The language syntax and type system, is so complicated that tools (IDEs, refactoring tools, debuggers, etc.) require like five times as much effort to build as comparable tools for a simpler language like Java do. Visual Studio represents MAN-CENTURIES of effort to try and make a useful IDE and toolchain for C++, and it still sucks donkey-balls compared to Java IDEs. It still can't even reliably do some of the basic stuff that the
Smalltalk refactoring browser could do in the 1980's, and that was in dynamically-typed language! Visual Studio is the pinnacle of C++ tooling; it might someday be supplanted by some LLVM-based tool, but for now VS is the state-of-the-art IDE. The best tool that money can buy, and it still sucks for C++. Java/C# IDEs are way better. Consider Eclipse for Java, for example. It has reliable Go To Definition/Find References that work 100% of the time, and automated refactoring support to rename things, move them around in the class hierarchy, etc. Eclipse had all of this stuff in its
first year of development, and Visual Studio still can't do it even after like 15 years of development. The reason is simple: C++ is basically impossible to make good tools for.
C++ is a language so vast and complicated, so full of thorny edge cases and incompatible features, that everyone sticks to just a subset of it. Virtually no one uses "the whole language", because a program doing that would be completely unmaintainable. But everyone uses slightly different subsets... some people use exceptions, some people (me) avoid them like the plague. Some people drink the iostreams kool-aid and use << to print out text, other people (me) prefer to use vendor extensions like _vsnprintf. Insane people use virtual base classes and pointer-to-member-functions and always use <algorithm> crap like "replace_copy_if" and "adjacent_find" to avoid writing a trivial 3-line loop that any programmer can read. Other people (me) prefer to write that loop and not have to google the algorithm name 3 months from now to find out WTF it does.
Anyway, its late and I'm tired, and thus prone to ranting.. Suffice it to say that if you are forced to do things in C++ under time pressure for a few years, and you constantly have to debug your screwups (and especially other people's screwups) you learn to have a healthy fear of multi-layered templates, of multiple inheritance, of type-casts of all kinds, and super anger about the stupid textual include model and lack of a proper module system even after *decades* of C++ use. C++ programs can now easily be 500x as big as typical C programs were back when that separate compile-and-link model was first developed. Hardware gets faster every year, and we're still saddled with compile times measured in minutes (or even in hours for some extremely large codebases). And IDEs still struggle to understand which macro definitions are effective in a certain source file, or which one of 12 different definitions of a method named "Serialize" is the one I want it to display.