Live data from Hacker News

Self-inlining anonymous closures in C++

matt.might.net

1–9 of 9 posts

Re: Self-inlining anonymous closures in C++

#5
post #3
post #2

Sorry, I can't see how this is an improvement over Boost::Phoenix: http://www.boost.org/doc/libs/1_44_0/libs/spirit/phoenix/doc...

Thanks for the pointer!

Now you get to run yourself in Valgrind to see if your guess about who's supposed to free it is correct.

Re: Self-inlining anonymous closures in C++

#6
A lot of people will read this and think "damn C++ is such an ugly language, it should never allow the programmer to do this!".

The reality is that that kind of technique allows to produce extremely fast code because the compiler has got so much "certain" information at compile time that it can optimize very aggressively.

It's more powerful than vanilla C macros because it works with the compiler, not the pre-processor.

Re: Self-inlining anonymous closures in C++

#7
post #6

A lot of people will read this and think "damn C++ is such an ugly language, it should never allow the programmer to do this!". The reality is that that kind of technique allows to produce extremely fast code because the compiler has got so much "certain" information at compile time that it can optimize very aggressively. It's more powerful than vanilla C macros because it works with the compiler, not the pre-process…

C++ is the highest-level language that I can accurately guess the assembly that will be actually run by the processor.

YMMV whether that's a blessing or a curse, though!