365Cocoa

A snippet of Objective-C code per day, 365 days long.
Written by Pieter Omvlee, developer and owner of Bohemian Coding.

Mar 26

Day 28: C99

Another quick tip today. When I started with Objective-C it really bugged me that the compiler wouldn’t accept the following:

for (NSInteger i=0; ...)

but instead forced you to do:

NSInteger i;
for (i=0; ...)

I found out that the standard C doesn’t allow this but that the C99 dialect of the compiler does. You can set it by going to your target, open up the inspector, go to the build tab and set the C language dialect to C99.


  1. 365cocoa posted this