One, Xcode's. m extension indicates that the file contains objective-c code and should be handled by the OBJECTIVE-C compiler. The C compiler handles files with names that end in. C, while the C + + compiler processes. cpp files. In Xcode, all of this compilation is handled by GCC, which can understand all 3 variants of the C language.
Second, when Objective-c was first born, the extension. m stands for message, referring to a major feature of Objective-c.
Third, like the C language, Objective-c uses header files to contain element declarations, including structures, symbolic constants, function prototypes, and so on. The C language uses the # include statement to inform the compiler that the definition should be queried in the header file. #import是GCC编译器提供的, Xcode will use it when compiling objective-c,c and C + + programs. #import可保证头文件只被包含一次, regardless of how many times the command actually appears in that file.
Four, in C, programmers typically use the #ifdef command-based scenario to avoid a file containing another file, which in turn contains the first file. In Objective-c, programmers use #import to implement this functionality.
Five, when you use NSLog () to output the value of any object, the%@ format is used, and when this specifier is used, the object provides its own nslog () format by means of a method called description. The NSString description method can simply output characters in a string.
Reference "Objective-c Basic Course"
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
"Reading notes" ios-objective-c to C extension basics