.c instead of .m projects in Objective-C?

I noticed that some Objective-C projects of some of the files that use a significant number of C functions store code in files .cinstead .m. I know .mfor Objective-C and .cC, but is there any use to using .cover .mwhen you can? Is there a performance increase or complication? Will GCC or clang compile the equivalent code differently in each?

+3
source share
3 answers

The main advantage is that .c files can be used as they are in regular C programs, and you know that they will not accidentally include Objective-C constructors that make them incompatible.

+6
source

Yes, Xcode will compile .c files with the 'C' compiler and .m with the 'Objective-C' compiler. This is the same binary compiler code, just using different language options. In this case, I did not expect the relative performance to be too different.

+2
source

,.c - . ., "C", , . , .

0

Source: https://habr.com/ru/post/1781171/


All Articles