From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@9fans.net Date: Thu, 3 Sep 2009 09:52:14 +0000 From: comeau@panix.com (Greg Comeau) Message-ID: References: <09650C1A-A4C8-4030-81D6-9AC8913970A2@kix.in>, <5d375e920909020532p1c3bd46l75d89db4f224301e@mail.gmail.com> Subject: Re: [9fans] "Blocks" in C Topicbox-Message-UUID: 609b9bda-ead5-11e9-9d60-3106f5b1d025 In article <5d375e920909020532p1c3bd46l75d89db4f224301e@mail.gmail.com>, Uriel wrote: >On Wed, Sep 2, 2009 at 10:04 AM, Anant Narayanan wrote: >> Mac OS 10.6 introduced a new C compiler frontend (clang), which added >> support for "blocks" in C [1]. Blocks basically add closures and anonymous >> functions to C (and it's derivatives). Full details with examples are in the >> linked article. I think the feature is quite elegant and might be useful in >> cases where you want map/reduce like functionality in C. > >Er., I might be more dumb than usual, but why on earth would you >need/want this garbage to get map/reduce functionality in C? > >To me it seems the typical "lets come up with some cute 'feature' and >then we will figure out how to hype ourselves all the way to hell". Ok, I'll plan devil's advocate: This cute stuff has been around for year and years and year already, just not in C. Also, cute stuff like designated initializers, compound literals (which actually at least to me look like this closure-like stuff), etc. in C I believe comes from Plan 9 C. So, it seems to me that if one wants compound literals then one probably would go for something like this block stuff. Certainly they do different things, but, still, just a thought. -- Greg Comeau / 4.3.10.1 with C++0xisms now in beta! Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?