[Reading Notes] iOS-Objective-C's basic knowledge of C extension, iosobjectivec

Source: Internet
Author: User

[Reading Notes] iOS-Objective-C's basic knowledge of C extension, iosobjectivec

1. Xcode's. m extension indicates that the file contains Objective-C code, which should be processed by the Objective-C compiler. The C compiler processes the file whose name ends with. c, and the C ++ compiler processes the. cpp file. In Xcode, all these compilation tasks are handled by GCC. This compiler can understand all three variants of C language.

 

2. When Objective-C was born, the extension. m represents message, which is a major feature of Objective-C.

 

3. Like C, Objective-C uses header files to Contain element declarations, including struct, symbolic constants, and function prototypes. C uses the # include statement to notify the compiler to query the definition in the header file. # Import is provided by the GCC compiler. Xcode uses it when compiling Objective-C, C, and C ++ programs. # Import ensures that the header file is contained only once, no matter how many times the Command actually appears in that file.

 

4. in C language, programmers usually use a solution based on the # ifdef command to avoid the situation where one file contains another file, while the latter contains the first file. In Objective-C, programmers use # import to implement this function.

 

5. When NSLog () is used to output the value of any object, the % @ format description is used. When this description is used, the object provides its own NSLog () through a method named description () format, NSString description method can simply output characters in the string.

 

References: Objective-C basic tutorial

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.