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 7903783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:50:08+00:00 2026-06-03T09:50:08+00:00

I have this method: + (MHTwitterParser*)createParser:(NSString*)format { if ([format compare:@json] == NSOrderedSame) { return

  • 0

I have this method:

+ (MHTwitterParser*)createParser:(NSString*)format {
    if ([format compare:@"json"] == NSOrderedSame) {
        return [[MHJsonTwitterParser alloc] init];
    }

    [NSException raise:@"Unknown format" format:@"Unknown format of parser"];
}

Compiler complains that:

Control may reach end of non-void function

It is just a warning, but it does not matter.

Obvious fix for that is to add for example return nil; after the [NSException raise: ....

However, I think it is not needed (and is even misleading for readers), because the exception is thrown, so it is not true that “Control may reach end of non-void function”. Or am I missing something …? Is it only compiler imperfection or there is some considerable reason for this?

The compiler is Apple LLVM compiler 3.1

  • 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-03T09:50:09+00:00Added an answer on June 3, 2026 at 9:50 am

    The reason is simple.

    For the compiler, the method [NSException raise: ...] is a black box method. It doesn’t know that the method will actually raise an exception.

    If you compare it with Java or C++, their throw statements are a language feature and the compiler knows exactly what will happen when it finds it. In Obj-C it’s different and sometimes it depends on runtime conditions. Consider the following.

    NSException* exception = nil;
    
    if (someCondition) {
    
       exception = [NSException exceptionWithName:...];
    }
    
    [exception raise];
    

    The compiler won’t know if the exception is really raised or not.

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

Sidebar

Related Questions

I have this method: -(NSString *)scrambleWordGenerator: (NSUInteger)length { NSMutableString *scrambledWord = [[NSMutableString alloc] initWithString:@];
I have this method def last_board user = current_user #current_user boards = current_user.boards #return
I have this method in my book model: def get_absolute_url(self): return /book/%s/%s/%i/%i/ % (
I have this method public Expression<Func<Auction, bool>> GetUnsetDatesAuctionsExpression() { if (condition) return GetAllUnsetDatesAuctionsExpression(); else
I have this method in a Directory model: public List<Directory> subdirectories() { return find(select
I have this method: public ActionResult MyMethod(string email, MyComplexObject json) When I call it
I have this method: -(IBAction)clickedDone; { UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; spinner.center =
I have this method: - (double) myMethod (double a, double b) { return a
I have this method in my videos controller: def notification_go current_user.render_read respond_to do |format|
I have this method to unit test: public virtual TEntity Get(int id) { return

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.