Objective-C is a strict super set of C. That is to say, absolutely anything that will work in C will also work exactly as is in Objective-C. What's more, Objective-C projects can even seamlessly integrate pure C files. This isn't necessarily all that common, but what is very common is significant chunks of pure C code in the middle of an Objective-C file.

I present this question as an example: Creating a better NSLog

Would a C language tag be appropriate/acceptable here?


2 Answers 2


When you have an question in front of you and are considering adding a tag on it, ask yourself this question:

Would someone who knows but not be interested in reviewing this code, as if it was ?

Regarding your specific example question there, I think the answer is no. I say this mainly because of lines like these:

timeStampFormat = [[NSDateFormatter alloc] init];
[timeStampFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss.SSS"];
[timeStampFormat setTimeZone:[NSTimeZone systemTimeZone]];

That doesn't look like C at all to me.

  • \$\begingroup\$ and .... what's this @import thing too...? \$\endgroup\$
    – rolfl
    Apr 26, 2014 at 13:54
  • \$\begingroup\$ But as the posted answer points out, this exact bit of code could be accomplish in plain C and probably more efficiently. Even if you don't know ObjC, it's pretty plain to see that snippet is trying to format a timestamp, which surely can be done in plain C. \$\endgroup\$
    – nhgrif
    Apr 26, 2014 at 16:25
  • \$\begingroup\$ @nhgrif But the question is about ObjC, not C. Language tags should be used according to the language in the question, not according to the language suggested to be used in answers. \$\endgroup\$ Apr 26, 2014 at 16:30
  • \$\begingroup\$ The question is about the best way to accomplish a task in Objective-C. Sometimes the best way to accomplish a task in Objective-C is by writing pure C code. As far as I know, this is a very special case. There are no questions about C++ where the answer could be to write the code in C instead of C++ because not everything that works in a .c file will work in a .cpp file, so you HAVE to know the differences between C++ and C to post an answer that will work for the question without recommending a different language. The same isn't true for Objective-C. \$\endgroup\$
    – nhgrif
    Apr 26, 2014 at 17:21

If you intend for the code to be polyglot, then use both tags. Otherwise, if you only want it to work as Objective-C, then just the tag should be used.

  • \$\begingroup\$ This would be a fair comment if I were asking the question the other way around "Should some C questions use the Objective-C tag?" But when we're talking about Objective-C and C, you can't really write code that's "just objective-c". As I stated, anything written in C will work exactly as is in Objective-C. This is code review, and if a person asking for a review of some Objective-C code is looking for the absolute most efficient way to do something, the answer will include a very deep dive in C sometimes. \$\endgroup\$
    – nhgrif
    Apr 26, 2014 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .