return break

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick Gleichmann wrote:
> Not really important, maybe it is simply a coding style question..
> 
> I came across some switch-cases (e.g. line 339, vdr.c):
> 
> case SOME_VALUE:
>   :
>   return SOME_CODE;
>   break;
> 
> 
> The "break" isn't required.

I'm not sure, but maybe it helps stupid compilers to fully understand 
whats happening, and maybe suppress a false warning.

For example, this function:
   int foo() { if (bar) return 1; else return 0; }
... will trigger a warning in GCC 2.95 because the compiler believes 
that not all paths return a result, though they do.

Cheers,

Udo



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux