Mailinglist Archive: opensuse-buildservice (233 mails)

< Previous Next >
Re: [opensuse-buildservice] no-return-in-nonvoid-function not always true
  • From: Philipp Thomas <Philipp.Thomas2@xxxxxxx>
  • Date: Thu, 18 Dec 2008 11:13:59 +0100
  • Message-id: <h98kk4966ddep4q3fbqn84qeqmuthm2q8r@xxxxxxx>
On Thu, 18 Dec 2008 08:25:22 +0100, you wrote:

int func(int i)
{
switch(i) {
case 1: return 4;
case 2: return 5;
}
/* no return after switch statement */
}

From a compilers POV this isn't OK. The compiler can't know that all
possible values of i have been handled, so it must assume that there's
a possibility that the end end of the function is reached and so warns
of the missing return.

Philipp
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
References