[parted-devel] eliminating switch vs. enum warnings

Otavio Salvador otavio at debian.org
Fri Feb 16 16:21:07 CET 2007


Jim Meyering <jim at meyering.net> writes:

> Do you mean the FAT_TYPE_FAT12 case *is* a "should not happen" case?
> Are you sure?  If so, I'll be happy to add the following for all of those:
>
>                 case FAT_TYPE_FAT12:
>                 PED_ASSERT (0, (void) 0);
>                 break;

I checked both the parted fat source and the linux fat source and
hadn't identified what's the right values to put for FAT12 hence I
think we might raise an exception instead of continue to work in that
case. Doing that would allow us to know if someone tries to use parted
in this specific case or not.

>> I think it's good to us be aware of what has been catch and then an
>> exception would help.
>
> Here, it's clear even to me (just learning about this code base)
> that the "default:" clause is a "should-not-happen" case.
> So I'm adding default blocks like this for each such switch
> on PED_EXCEPTION_* values:
>
>             default:
>                     PED_ASSERT (0, (void) 0);
>                     break;

Right.

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio at debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."



More information about the parted-devel mailing list