[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: Missing defaults in switches
From:       Rafael Garcia-Suarez <rgarciasuarez () gmail ! com>
Date:       2005-10-31 7:29:15
Message-ID: b77c1dce0510302329i1df65427y778f5a845ee30aa2 () mail ! gmail ! com
[Download RAW message or body]

On 10/31/05, Andy Lester <andy@petdance.com> wrote:
> I've been playing with GCC switches some more.  There's a switch that
> finds switch() statements w/o default cases.  There are plenty.
>
> Do we care?  Seems to me that a
>
>     default:
>         assert(0);
>         break;
>
> at the bottom of each of these switch() statements might be a good thing
> to have.

I think they're mostly already protected wisely; in general switch is
used in clever ways in perl's source code, so if you don't have a
final break or fallback, there might be a good reason for it. Adding
default clauses mechanically might be dangerous.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic