Re: Xcode now defaults to use C99 - so what's C99?
Re: Xcode now defaults to use C99 - so what's C99?
- Subject: Re: Xcode now defaults to use C99 - so what's C99?
- From: "Clark Cox" <email@hidden>
- Date: Fri, 30 May 2008 19:35:20 -0700
On Fri, May 30, 2008 at 7:09 PM, Jean-Daniel Dupas
<email@hidden> wrote:
>
> Le 30 mai 08 à 23:07, Jens Alfke a écrit :
>
>> C99 is very cool; it has many useful features, so don't be put off by the
>> idea of huge specs. Those articles look pretty useful if you haven't already
>> been using C99.
>>
>> The best features IMHO are:
>>
>> * Conveniences that C++ has always had:
>> * variable declarations don't have to go at the beginning of a
>> block (this *really* cleans up code and eliminates a lot of opportunities to
>> use uninitialized variables)
>> * you can declare the loop variable inside a 'for' loop, i.e.
>> for (int x=0; x<10; x++) { ... }
>> * "//" comments; but I think in the real world, all C compilers
>> already supported those
>> * Variable-length local arrays. This is syntactic sugar for alloca, and
>> can be used to eliminate some temporary allocations. Just be careful not to
>> use this with arbitrarily large arrays, or you can overflow the stack.
>> size_t size = strlen(str)+1;
>> char buf[size];
>> memcpy(buf,str,size);
>>
>> The improvements to struct initializers are great, too.
>>
>> And if that's not enough for you, you can set the compiler dialect to
>> "G99" and get a bunch of cool GCC-only extensions. You can read about those
>> in the GCC 4 documentation buried inside the developer docs.
>>
>> —Jens
>
> Note that most of those features was already provided by gcc as gnu
> extensions using the previous default mode, gnu89.
Indeed, but now they're supported by the standard. Additionally,
several C99 features vary subtly from the equivalent GNU89 extensions.
--
Clark S. Cox III
email@hidden
_______________________________________________
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