Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8348505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:42:34+00:00 2026-06-09T07:42:34+00:00

Since Objective-C is a C superset, all Objective-C specific statements are converted into C

  • 0

Since Objective-C is a C superset, all Objective-C specific statements are converted into C statements during the compiling of a .m file (by the preprocessor, I guess). So, for example, a message expression like [receiver method] is converted into a call on the messaging function objc_msgSend(receiver, selector).

My question is: if I have a class definition like this:

@interface ClassA {
    int var1;
    float var2;
    id var3;
}

-(void) method1;
-(int) method2: (int) num1;
@end

@implementation ClassA
-(void) method1 {
    // Implementation of the method
}

-(int) method2: (int) num1 {
    // Implementation of the method
}

@end

what is it converted into by the compiler (in 2.0 version of Objective-C)? Is it converted into calls on functions like objc_allocateClassPair(), class_addIvar(), class_addMethod() and objc_registerClassPair(), in order to create the class, add its instance variables, add its methods and register the class, respectively (So that the class struct is actually defined in runtime instead of being loaded as a struct from the executable file)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:42:35+00:00Added an answer on June 9, 2026 at 7:42 am

    Since Objective-C is a C superset, all Objective-C specific statements
    are converted into C statements during the compiling of a .m file (by
    the preprocessor, I guess).

    That was true in 1988. While Objective-C could still be compiled in that fashion, it hasn’t been in a long time.

    The compiler parses Objective-C, along with C and– sometimes– C++, and emits an abstract syntax tree [AST] that represents the post-preprocessed output. That AST includes the various Objective-C definitions quite directly.

    Note that the details of GCC’s compilation and LLVM’s compilation are diverging.

    If you look at the compiled output, you’ll see that the mach-o file — the executable product — has various sections in the file that contain the Objective-C metadata including class definitions, selector tables, ivar layout, etc… The compiler generates this metadata into the .o file and then the linker mashes it all together, eliminates duplicate information (that isn’t a duplicate symbol), and writes the mach-o.

    As someone mentioned in a different question, you can use the Objective-C rewriter to rewrite Objective-C to straight C, but the resulting code is inefficient and quite a bit different than the regulation compilation pipeline.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Objective: My script will download a remote file upon form submission, since the file
Since Objective-C is basically an extension of C, Does the code get converted to
I'm pretty new to all that iOS stuff and Objective C- Programming. Since I'm
I'm seeing an odd behavior with trying to get seconds since epoch in objective
I'm writing a program that calculates the Jacobi algorithm. It's written in Objective-C since
My problem is since an enum in objective-c essentially is an int value, I
Objective: I need to create a CSV file via PHP but limit download access
There have been some discussions on how to organize your #import statements in objective-c.
I want to create an Objective-C base class that performs an operation on all
I am little confused finding C style syntax in an Objective-C project (for example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.