views:

143

answers:

3

Same question as: http://stackoverflow.com/questions/696218/do-line-file-equivalents-exist-in-c

But for Objective-C in iPad/iPhone SDK Xcode? This would really help my NSLog statement be a lot more readable over time.

+5  A: 

Yes, they do:

 NSLog(@"%s:%d", __FILE__, __LINE__);

Output is e.g.:

/Path/to/file.m:42

Georg Fritzsche
+1  A: 

I would have to go back and look at the Objective C documentation, but my guess would be "most certainly" since these are core to the C Programming Language and Objective C is an extension of it.

D.Shawley
+4  A: 

Not a specific answer (since those have already been posted), but a list of the standard predefined macros can be found here: http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/cpp/Standard-Predefined-Macros.html#Standard-Predefined-Macros

This lists things like __LINE__, __FILE__, __DATE__, __FUNCTION__, etc.

Dave DeLong