Re: code after return

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

 



The given example doesnt really need break statements...

On Thu, Sep 11, 2008 at 1:56 PM, Richard Genoud
<richard.genoud@xxxxxxxxx> wrote:
>
> 2008/8/31 Julia Lawall <julia@xxxxxxx>:
> > Below is a list of some places (file and function name) where there is
> > some code after a return or goto.  Most of the time, the return is in a
> > switch case, and the code after the return is a break.  I was wondering
> > whether it would be useful to do something about these?  Or is the thought
> > that it has no impact on the compiled code, so it doesn't matter?  Or is
> > it actually desirable to have a break in every switch case, even if it
> > amounts to dead code?
> >
> > thanks,
> > julia
>
> IHMO, those breaks (and the superfluous semicolon) should be removed.
> In the CodingStlye document there's a switch/case example (actually,
> it was a placing braces example) like that :
>
> switch (action) {
> case KOBJ_ADD:
>        return "add";
> case KOBJ_REMOVE:
>        return "remove";
> case KOBJ_CHANGE:
>        return "change";
> default:
>        return NULL;
> }
> So, it seems that there's no rule like having a break in every switch case.
>
> Anyone, another opinion ?
>
> richard.
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



--
----------------------------------------------
"Why is it that every time I'm with you, makes me believe in magic?"
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux