"Reading notes" ios-objective-c to C extension basics

Source: Internet
Author: User

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

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.