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

  • SEARCH
  • Home
  • 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 7873831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:37:43+00:00 2026-06-03T02:37:43+00:00

With the dawn of ARC came a new main function template in xcode that

  • 0

With the dawn of ARC came a new main function template in xcode that makes a lot more sense. However, I have a question about the old template.

As everyone knows, the old main function template in XCode for Cocoa touch applications was this:

int main(int argc, char *argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}

However, the last two lines are unreachable because the docs clearly state that UIApplicationMain never returns. It simply makes a call to exit() when it is done. So why did Apple opt for a template like this? Why not just this?

int main(int argc, char *argv[]) {

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    return UIApplicationMain(argc, argv, nil, nil);
}

Is it because people would take this as an example, and not release their autorelease pools properly? Or because it would trip up the static analyzer? Or something else possibly?

That question might be too open-ended so I will ask it another way. Is there a technical reason for using the template the way that Apple did?

  • 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-03T02:37:45+00:00Added an answer on June 3, 2026 at 2:37 am

    Not a great answer but if you actually try your example then you get an Unused variable warning, which would be a bit slack to give everyone a warning with a freshly created project.

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

Sidebar

Related Questions

I have a loadMask. This sets a gray background and on top of that
I have this question since the dawn of my programming career. Is there really
I am new to this. We have a wedding photography web site. http://www.DawnKellyPhotography.com/fbshare/FBalbum/ I
How to tell web.xml that it should not handle .htc files and so leave
This seems to be a tough nut to crack. I'm hoping that it's pretty
I build a website, in this website I have this two buttons by jQuery
I have recently written a dynamic querying tool using expression trees and as I
Let say I have complete Image of Newspaper front page i want it make
I want to bind drop dawn list using jquery depends on another ddl i
iTunes URLs look like the following: http://itunes.apple.com/us/album/break-of-dawn/id472335316?ign-mpt=uo%3D http://itunes.apple.com/us/app/monopoly-here-now-the-world/id299110947?mt=8 http://itunes.apple.com/es/app/revista-/id397781759?mt=8%3Futm_so%3Dtwitter http://itunes.apple.com/app/id426698291&mt=8 http://itunes.apple.com/us/album/respect-the-bull-single/id4899 http://itunes.apple.com/us/album/id6655669 How can

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.