News for hackers. Stuff that matters.
Re:Self-inlining anonymous closures in C++ by omnigoat on Thursday September 23, 2010 @07:36PM (#1722003)
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...

Re:Self-inlining anonymous closures in C++ by mattmight on Friday September 24, 2010 @12:28PM (#1724187)
It isn't meant to be an improvement or a replacement.

It's just a tutorial on how such things are done. :)

Re:Self-inlining anonymous closures in C++ by util on Friday September 24, 2010 @12:29AM (#1722669)
Thanks for the pointer!
Re:Self-inlining anonymous closures in C++ by jrockway on Friday September 24, 2010 @02:34AM (#1722916)
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++ by shin_lao on Friday September 24, 2010 @05:27AM (#1723164)
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++ by andymorris on Friday September 24, 2010 @05:50AM (#1723199)
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!

Re:Self-inlining anonymous closures in C++ by jongraehl on Friday September 24, 2010 @01:16AM (#1722784)
$ in C++ identifiers is a nonstandard extension that gcc allows on some platforms - cool (and not portable).
Re:Self-inlining anonymous closures in C++ by gjm11 on Friday September 24, 2010 @06:01AM (#1723215)
You could use, say, "ARG_" instead and it would work just the same. (Phoenix uses "arg".)