• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: curly braces to return value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: curly braces to return value


  • Subject: Re: curly braces to return value
  • From: Wim Lewis <email@hidden>
  • Date: Tue, 06 Aug 2013 11:23:56 -0700

On 6 Aug 2013, at 9:16 AM, Howard Moon wrote:
> On 6 Aug 2013, at 8:41 AM, Matt Neuburg wrote:
>> It's like, did C suddenly turn into Ruby? :) Anyway, I'd be interested in hearing opinions of this. I'm a bit leery of taking advantage of GCC extensions to the C language, not least because you never know when they will vanish out from under you; I still haven't recovered from the day that local function-within-method went away and left me twisting in the wind... :))) m.
>
> Doesn't that GCC extension require ({…}), not just {…}?
>
> (And since it's a GCC extension, it's not portable.)

It's a GCC extension [1] but Clang also supports it [2]. It actually seems to have made its way into a number of other compilers as well.

Portability's a subtle issue since most of the code we might discuss on this list relies on Apple-specific language features that only Clang or GCC supports anyway, but I agree it's good to be aware of that even if you do choose to use language extensions.

 [1] http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
 [2] http://clang.llvm.org/doxygen/classclang_1_1StmtExpr.html



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >curly braces to return value (From: Matt Neuburg <email@hidden>)
 >Re: curly braces to return value (From: Howard Moon <email@hidden>)

  • Prev by Date: Re: curly braces to return value
  • Next by Date: Re: curly braces to return value
  • Previous by thread: Re: curly braces to return value
  • Next by thread: Re: curly braces to return value
  • Index(es):
    • Date
    • Thread