In article <8214db3a-3368-4b61-b0cd-bac5f2be7...@sun.com>,
Roman Shaposhnik <r...@sun.com> wrote:
>There's been a *lot* of speculation on this thread and very little fact.
>I'd encourage everybody to play with the feature before forming
>any kind of final judgement.

This is true, a good point, etc, however....

>On Sep 3, 2009, at 8:52 PM, erik quanstrom wrote:
>>> Did you even read the article or any of the examples? There are  
>>> plenty
>>> of things that you can "do" with blocks that you can't with just
>>> function pointers. That's besides the fact that some of them are more
>>> elegantly expressed with blocks that look sort of ugly with function
>>> pointers.
>>
>> on the other hand, apple says this is illegal
>
>Where exactly does it say that?
>
>>        dispatch_block_t p;
>>
>>      if(cond){
>>              p =^ { print("cond\n"); };
>>      }else{
>>              p =^ { print("cond\n"); };
>>      }
>>      p();
>>
>> since the first part is equivalent to
>>
>>      if(cond){
>>              struct Block _t = ...;
>>              p = &_t;
>>      }
>
>I'm pretty sure Apple's compiler is smart enough to allow the  
>construct that you've just mentioned. In fact, I'd be willing
>to bet on it.

.... I'm fairly certain I was confused about this when I originally
read that document.  I think (I can't recall) the example being
in a different language than C so coughed it up to some different
scoping rules or something in that other language.

So, the clincher is, if it's the case, since it seems obvious that
the construct could work the way one would intuitively?? think it
would work, then, why doesn't it?
-- 
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?

Reply via email to