svn commit: samba r10184 - in branches/SAMBA_4_0/source/librpc/rpc: .

derrell at derrell at
Mon Sep 12 23:43:54 GMT 2005

Tim Potter <tpot at> writes:

>> One of the really nice features of using enums is that the compiler can
>> help the developer find missing code.  When cases aren't handled in a
>> switch statement, you get this warning.  That luxury is lost if you add a
>> "default:" label to the switch.
> Sure - I agree in the case where the programmer has not implemented that
> arm of the switch statement yet.  It seems a bit pointless listing all
> the unused enumeration values though - what if there are 100 of them?  I
> don't think it adds to the readability of the code.

When one person will always be working on particular code, it doesn't matter
too much.  When someone less familiar with the code picks it up and tries to
work on it, those warnings become really useful.  Even if there are many enum
values that must be listed and ignored, I'd still prefer to see them
enumerated in the switch to aide the next guy who needs to work on the code
than to see a default: label that obscures the next guy's problems.


More information about the samba-technical mailing list