delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/20/15:29:21

Message-ID: <02a901c09b7c$92b8abc0$6300a8c0@brk>
From: "Johan Henriksson" <jhe AT realsoftware DOT cjb DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: What does this mean?
Date: Tue, 20 Feb 2001 21:22:24 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

from: Johan Henriksson, leadprogrammer @ www.realsoftware.cjb.net
"The individual should be praised for it's struggle, the society
condemned for it's actions" - me 1997        #12035895
----------------------------------------------------------------------------
-------------------

>> I have a warning that says: "control reaches end of non-void function".
What
>> would be some reasons I would get this?


Is there a way to tell GCC stop complaining about this? In some more
advanced cases with return()'s, GCC misses the return and think
it might not happen. Consider this:

...
switch(val)
 { case 1: return(2);
   case 2: return(3);
   default: return(5);
 }
}

I'm not sure but I think this is one of the codesnippets that fool's GCC.
The
solution for removing the complaint is a dummy-return in the end but this
bothers me. Is there a nicer general solution? (yes, the above can easily be
solved by moving the default).

TIA

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019