Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does every Objective C program get converted to C code?

Tags:

c

objective-c

Since Objective-C is basically an extension of C, Does the code get converted to pure C code before it is compiled to native code ?

If so, does the conversion happens on RAM or a temporary file containing C code on disk is created by the compiler which is further compiled by C compiler to native code ?

like image 870
Amogh Talpallikar Avatar asked Jan 09 '12 11:01

Amogh Talpallikar


People also ask

Does Objective-C compile to C?

Objective-C compiles into machine code. Remember that the language (Objective-C, C, C++) only defines the rules to correctly write code. The compiler checks to see if your code is correct and compiles it, i.e., translates it into executable code. Also, don't confuse Objective-C language, and the Objective-C runtime.

Did Apple make Objective-C?

Objective-C was the standard programming language supported by Apple for developing macOS (which descended from NeXTSTEP) and iOS applications using their respective application programming interfaces (APIs), Cocoa and Cocoa Touch, until the introduction of Swift in 2014.

Is Objective-C oop language?

Objective-C is the primary programming language you use when writing software for OS X and iOS. It's a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime.

How do I download from Objective-C?

In order to get full features of Objective-C, download and install GNUStep. This can be done by downloading the package from http://main.gnustep.org/resources/downloads.php.


2 Answers

That Objective-C syntax is an extension of C syntax does not mean that it could not have its own compiler. C++ is the same way - its syntax is compatible with C (for the most part, anyway) but it has its own set of tools. Compilers for C, C++, and Objective-C can reuse parts of each other for preprocessing, syntactic analysis and code generation, but there is not need to run them sequentially (e.g. Objective-C ==> C ==> Target code). Compilers no longer go through human-readable assembly language, either (this has been the case for a very long time, too).

like image 61
Sergey Kalinichenko Avatar answered Oct 06 '22 11:10

Sergey Kalinichenko


No, Objective-C gets compiled to assembler directly (assuming GCC).

like image 29
Fred Foo Avatar answered Oct 06 '22 11:10

Fred Foo