Live data from Hacker News

Has C++ jumped the shark?

johndcook.com

21–30 of 69 posts

Re: Has C++ jumped the shark?

#21
post #8

C++ is the only language I'm aware of where every extension made to the language is careful to only affect compilation time/complexity, while preserving the speed and operational semantics of the code at runtime. This makes it perfect for some domains, e.g. console game development, where the speeds required are only attainable by dicking around with pointers in C, but people want to use better abstractions than C is…

This is thing that annoys me about C++'s illusion of control: unless you have / take full responsibility over the compiler and standard library, the "control" that C++ gives you is actually an abnegation of choice which leaves you to reinvent the world if you want specific features. What if you want something like Smalltalk / Lisp images? Runtime code generation and optimization of virtual method calls? Precise garbage collection? C++ leaves you on your own if you want these things in your final executable, and you have to work very hard - to the point of implementing a DSL, or writing / modifying your own C++ compiler - if you do want them.

Re: Has C++ jumped the shark?

#22
post #12
post #4

I've written in C++ professionally almost 12 years (17 years counting College), and in my opinion it is a shame how the language has not evolved properly. Unsolved things: - Unified C++ ABI call for making shared libraries without worrying about compiler manufacturer or version. - Massive bloat. Take a look to the Boost libraries and cry. - Poor debugging tools for templates (debugging templates it is crazy, and the…

"Massive bloat. Take a look to the Boost libraries and cry." Aside from your tears, what is the evidence that boost is bloated? Too slow? Too much source code? Too many files? I've been using Boost for nearly a decade. It does a ton of useful stuff (from template metaprogramming to fast matrix algebra), it's loosely coupled, and it's insanely fast. Given it's scope, it's the least bloated library of which I know. C++…

There is bloat and there is bloat. I'm currently playing with a 200-line file that is mostly a wrapper around a subset of boost::polygon (basically it's a single-type specialization wrapped in a simpler API).

With gcc 4.4.5 and -O2, this one small file takes 22 seconds (!) to compile and produces a 14MB output file.

I guess that's... tolerable. But it isn't "lean" in any meaningful sense.

Re: Has C++ jumped the shark?

#23
I use C++ often, and what I'd like to see are good datastructures, built right into the language syntax, like Python does that with dicts, lists, tuples, sets etc... I know that STL has these, but using them still feels like some grafted-on afterthought.

Re: Has C++ jumped the shark?

#24
post #8

C++ is the only language I'm aware of where every extension made to the language is careful to only affect compilation time/complexity, while preserving the speed and operational semantics of the code at runtime. This makes it perfect for some domains, e.g. console game development, where the speeds required are only attainable by dicking around with pointers in C, but people want to use better abstractions than C is…

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)

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?

#25
post #22
post #12

Earlier quoted context omitted.

"Massive bloat. Take a look to the Boost libraries and cry." Aside from your tears, what is the evidence that boost is bloated? Too slow? Too much source code? Too many files? I've been using Boost for nearly a decade. It does a ton of useful stuff (from template metaprogramming to fast matrix algebra), it's loosely coupled, and it's insanely fast. Given it's scope, it's the least bloated library of which I know. C++…

There is bloat and there is bloat. I'm currently playing with a 200-line file that is mostly a wrapper around a subset of boost::polygon (basically it's a single-type specialization wrapped in a simpler API). With gcc 4.4.5 and -O2, this one small file takes 22 seconds (!) to compile and produces a 14MB output file. I guess that's... tolerable. But it isn't "lean" in any meaningful sense.

Try stripping debug symbols. As to compile time, the pimpl pattern is your friend here.

Re: Has C++ jumped the shark?

#26
post #20

Languages are tools. Da Vinci with a mop and a bucket of mud would be a better painter than me. In fact I recently saw a video where Kelly Slater surfed a door and a coffee table as impressively as most weekend warriors surf on $700 custom shaped boards. Focus on your skill not the tools. Surfing is more about timing, fitness and knowledge of waves than it is about the board. Likewise coding is more about RAM, CPUs,…

"Likewise coding is more about RAM, CPUs, HDs, GPUs, busses, networks and ultimately users than it is about what tools you use to manipulate them."

My coding is primarily about managing complexity through good abstractions, and sometimes doing optimizations. Different languages are better suited to good abstractions. Kelly Slater might use a coffee table for fun one time, but he won't use one for his next competition.

Re: Has C++ jumped the shark?

#27
post #20

Languages are tools. Da Vinci with a mop and a bucket of mud would be a better painter than me. In fact I recently saw a video where Kelly Slater surfed a door and a coffee table as impressively as most weekend warriors surf on $700 custom shaped boards. Focus on your skill not the tools. Surfing is more about timing, fitness and knowledge of waves than it is about the board. Likewise coding is more about RAM, CPUs,…

You're right that people should be worried about their skills. But tools are a critical part of actually programming.

It's like saying "famous author X used pen and paper, hence complaining that Word 2010 doesn't handle Y properly is silly - focus on your writing!" (Worse even, as for pure writing, the speedup between pen/typewriter/Word is probably less pronounced than between programming languages.)

Re: Has C++ jumped the shark?

#29
post #20

Languages are tools. Da Vinci with a mop and a bucket of mud would be a better painter than me. In fact I recently saw a video where Kelly Slater surfed a door and a coffee table as impressively as most weekend warriors surf on $700 custom shaped boards. Focus on your skill not the tools. Surfing is more about timing, fitness and knowledge of waves than it is about the board. Likewise coding is more about RAM, CPUs,…

a video where Kelly Slater surfed a door and a coffee table as impressively as most weekend warriors surf on $700 custom shaped boards.

I saw a table tennis player all excited about his new carbon fiber paddle. Then one of the club champs picked up the box the new paddle had come in and, using the box as a paddle, proceeded to defeat the player with the carbon paddle.

Re: Has C++ jumped the shark?

#30
post #12
post #4

I've written in C++ professionally almost 12 years (17 years counting College), and in my opinion it is a shame how the language has not evolved properly. Unsolved things: - Unified C++ ABI call for making shared libraries without worrying about compiler manufacturer or version. - Massive bloat. Take a look to the Boost libraries and cry. - Poor debugging tools for templates (debugging templates it is crazy, and the…

"Massive bloat. Take a look to the Boost libraries and cry." Aside from your tears, what is the evidence that boost is bloated? Too slow? Too much source code? Too many files? I've been using Boost for nearly a decade. It does a ton of useful stuff (from template metaprogramming to fast matrix algebra), it's loosely coupled, and it's insanely fast. Given it's scope, it's the least bloated library of which I know. C++…

> ton of useful stuff (from template metaprogramming to fast matrix algebra), it's loosely coupled, and it's insanely fast

It's actually not all that fast in a lot of cases. Boost's matrix manipulation support is particularly slow:

http://eigen.tuxfamily.org/index.php?title=Benchmark-August2...

Also a lot of the template aerobatics generate a ginormous number of symbols which massively increase the binary size and cache pressure. In a former life I ripped out a pile of heavily templated code using Boost and replaced it with a well placed virtual function or three and dramatically reduced the cache misses in the application.

I've always seen Boost (and to a large extent the STL) as a demo library to show off what's possible with templates rather than something to be used in everyday code and have worked on a number of projects which forbade both.

There's a large rift in the C++ world between what I generally label Qt and Boost camps. The Boost people see the Qt folks as Java-esque dimwits that can't be bothered to learn the full extent of C++'s power and the Qt folks see the Boost following as unpragmatic architecture astronauts.

Post reply on HN