Path: csiph.com!feeder.erje.net!2.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!buffer1.nntp.ams1.giganews.com!buffer2.nntp.ams1.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Thu, 10 Nov 2016 02:33:12 -0600 From: Gareth Owen Newsgroups: comp.lang.c Subject: Re: Compiler design in C? References: <0915fef9-bb57-48b7-b98a-342f0e5ee39f@googlegroups.com> <87shr14n5b.fsf@gmail.com> <87r36k1l4w.fsf@gmail.com> <3e47c9bc-1c0a-40dc-9dc3-92e88ace6c31@googlegroups.com> <87lgwrzvqt.fsf@gmail.com> <87lgwrdaiu.fsf@gmail.com> Date: Thu, 10 Nov 2016 08:33:11 +0000 Message-ID: <87shqz7n08.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:F5VYbCUW02nCUEeTDNndQOUDWmM= MIME-Version: 1.0 Content-Type: text/plain Lines: 30 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-4OKVvzjw6Rhvnhq1Znk96IdR+p50RFKzqOxa5wQhIvP4m48c4/MvH3d5bRdTi51BCCpUcMIyNs48Ppp!+YxFqc+OE06cknFUoFWH1LQvlyOgYUcDNesOnE5WTJd1t1UgPKWhC3gOLqttU791uHOr X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2492 Xref: csiph.com comp.lang.c:96272 Melzzzzz writes: >> Yes, but it was also what I was saying. > > Question is: What's advantage of C++ in this case? I can implement my function in C++, using features in C++. As a simple example: extern "C" void sort_doubles(double array[],int count) { std::sort(array,array+count); } Want some easy standardised parallelism? /// Untested - I may have got the lambda syntax wrong extern "C" double sum_array_parallel(const double array[], int count) { std::future fut = std::async(std::launch::async, [array,count](){ return std::accumulate(array,array+count/2,0.); }); double last = std::accumulate(array+count/2,array+count,0.); return last + fut.get(); } I'm sure Jacob will be here shortly to tell you that the latter would be simpler and far more readable if I did it with C11 threads.