C99 Considered Harmful

Posting this just so if someone else runs into the problem they’ll hopefully find this and find the solution.

I like to use OCUnit:http://developer.apple.com/documentation/DeveloperTools/Conceptual/UnitTesting/Articles/CreatingTests.html for unit testing my Objective-C code. PowerCard has unit tests using this, and I was starting a new project, and set it up, and wrote some unit tests. I started to see the following error:

syntax error before ‘typeof’

This persisted even with the simplest of test cases like:

-(void)testSomething; { STAssertEqualObjects(@"foo", @"bar", nil); }

Seemed to have something to do with the STAssertEqualObjects macro.

Anyway, after much digging and trying to figure out what the problem was. I discovered it was because I had enabled the “C99” setting in the C Language Dialect setting of my target instead of using “GNU99”. I have wondered for a long time what the difference was. I guess now I know I should just use GNU99 for everything.

Posted On 2008-01-25 01:39:00 UTC by Jiva
Back
Comments: