LWN.net Logo

A look at C++14, part 1

A look at C++14, part 1

Posted Mar 28, 2013 22:35 UTC (Thu) by nix (subscriber, #2304)
In reply to: A look at C++14, part 1 by tchernobog
Parent article: A look at C++14, part 1

I wrote something similar for C about ten years ago. It is extremely useful, in all sorts of unexpected places. (Just like Unix pipelines are.)


(Log in to post comments)

A look at C++14, part 1

Posted Mar 28, 2013 23:47 UTC (Thu) by tpo (subscriber, #25713) [Link]

Pipelines start to be really exciting, when they auto-parallelize their individual stages. If you have that, you can start doing CSP style programming, which spares you a lot of the pain shared state concurrent programming would cause you.

Does your implementation provide nice syntax (via a macro?) and do autoparallelization? I'd would love to see that code... :-)

*t

A look at C++14, part 1

Posted Mar 29, 2013 15:43 UTC (Fri) by nix (subscriber, #2304) [Link]

It didn't provide particularly nice syntax: it just provided a way to chain functions onto the stdin, stdout and stderr (optionally combined) of fork()/exec()ed subprocesses, so it looked like execl() with extra arguments jammed on the start to signify the stdin / stdout / stderr functions (if any: if none, /dev/null got attached to that fd instead). No pretty pipelining unless you invoked the function again in the stdout or stderr functions. But, obviously, the thing was parallelized: it was just pipes under the surface, after all.

This proposal is definitely better than what I hacked up. :)

A look at C++14, part 1

Posted Mar 29, 2013 18:49 UTC (Fri) by guillemj (subscriber, #49706) [Link]

Also for C, there's <http://libpipeline.nongnu.org/>.

A look at C++14, part 1

Posted Mar 31, 2013 14:08 UTC (Sun) by nix (subscriber, #2304) [Link]

That's a nice API. I'll definitely be using that, although its being GPLv3 (not even GPLv2+) greatly restricts the set of projects that can benefit from it...

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds