• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Uhmm, this warning is a bug, or am I missing something?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Uhmm, this warning is a bug, or am I missing something?


  • Subject: Re: Uhmm, this warning is a bug, or am I missing something?
  • From: Eric Albert <email@hidden>
  • Date: Thu, 26 Jan 2006 15:42:25 -0800

On Jan 26, 2006, at 3:03 PM, Scott Ribe wrote:

OK, I admit this function is nasty, but it's quick work while I figure out
how to handle this data:


static NSString * StringForInterval( const interval & val )
{
if( (val.startn != val.endn && val.startp == val.endp) && (val.endn != 0
|| val.endp != '\0') )
return [NSString stringWithFormat: @"%@ - %@",
StringForIntervalPart( val.startn, '\0' ),
StringForIntervalPart( val.endn, val.endp )];
else if( (val.startn != val.endn || val.startp != val.endp) && (val.endn
!= 0 || val.endp != '\0') )
return [NSString stringWithFormat: @"%@ - %@",
StringForIntervalPart( val.startn, val.startp ),
StringForIntervalPart( val.endn, val.endp )];
else
return StringForIntervalPart( val.startn, val.startp );
}

And the last line where StringForInterval is called gives this warning:

ClinicCheckOut_WC.mm:237: warning: control may reach end of non-void
function 'NSString* StringForInterval(const interval&)' being inlined

And my reaction is "no, in fact, StringForInterval will always return a
value". Am I missing something wrt to Objective-C???

No...it's just that sometimes the compiler has a tough time determining that there are no code paths which fail to have a return statement, particularly if you're building with optimizations enabled. You can file a bug report if you'd like, but the easy workaround is to take this:


    else
        return StringForIntervalPart( val.startn, val.startp );

and turn it into this:

    return StringForIntervalPart( val.startn, val.startp );

Hope this helps,
Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Uhmm, this warning is a bug, or am I missing something? (From: Scott Ribe <email@hidden>)

  • Prev by Date: Uhmm, this warning is a bug, or am I missing something?
  • Next by Date: Xcode - linking libraries based on Configuration
  • Previous by thread: Uhmm, this warning is a bug, or am I missing something?
  • Next by thread: Xcode - linking libraries based on Configuration
  • Index(es):
    • Date
    • Thread