Why is "@" used before strings in Objective-C?

Possible duplicate:
The purpose of the @ character before the lines?

I was curious what it means @before each line is objective C. Is it easier on the compiler or more efficient?

Example:

NSString* flavour = @"Chocolate"
+5
source share
4 answers

@"Chocolate"- this is just a shortcut to create an instance NSString. You can also use:

[[NSString alloc] initWithUTF8String:"Chocolate"];

If you did not use @, you would create a string C (array char).

+8
source

@ C ++, Objective-C , . "Objective" C ++.

+3

Since Objective-C is a superset of simple C, there should be a way to distinguish NSStringliterals from simple C lines (which are basically just pointers char*).

+1
source

Differences between c lines and objective-c class I think

0
source

All Articles