so what I'm trying to say is that the "main" method in main.m file does not have a - or + prefix and the parameters are in parenthesis w/o any colons. So what is it all about? Looks like c-style :P Thanks!
Asked
Active
Viewed 87 times
1 Answers
2
Its because it is a C function but it calls NSApplicationMain. NSApplicationMain is just the entry point for Cocoa applications. The arguments passed function exactly the same way as well. NSApplicationMain can be thought of as a second, inner main function, which is called by the first main.
As to why it is called .m, there is another question here that gets answered: Here

Community
- 1
- 1

Joseph Pla
- 1,600
- 1
- 10
- 21
-
1Okay I understood that it's c-style but is it really pure c-language or just c-style? If c-language then why is it .m file not an .mm or .c? And why can't that just be objective c as well? – Jf1nG Jul 27 '13 at 14:50
-
This is so that you can mix Objective C and C code. **.m** can be written in both C and Obj C. – Joseph Pla Jul 27 '13 at 14:57
-
The main function is indeed pure C. – Joseph Pla Jul 27 '13 at 14:59
-
Then what's the need of mixing too programming languages? Isn't one just enough? – Jf1nG Jul 27 '13 at 15:20
-
@Jf1nG That is an entire other question that is way too long for me to answer ;) – Joseph Pla Jul 27 '13 at 15:21
-
@Jf1ng Essentially, "almost" all C code is backwards compatible with Objective C, as Objective C is a superset of C. It is the same case with C++ for the most part. But again, the answer as to why it is necessary is complex and long. – Joseph Pla Jul 27 '13 at 15:24
-
@Jf1ng Some libraries are written in C must be called with native C for example. – Joseph Pla Jul 27 '13 at 15:27
-
2@Jf1ng not trying to boost rep or anything. But normally it is good to accept an answer if it helps you. If it didn't help you, feel free to not worry about it, but atleast for the future ;) – Joseph Pla Jul 27 '13 at 15:57