On 2013-01-31 14:50:38 +0100, grischka wrote: > Vincent Lefevre wrote: > >On 2013-01-31 13:22:22 +0100, grischka wrote: > >>Vincent Lefevre wrote: > >>>Perhaps there was a "default:" by default the author forgot to remove. > >>>And as it is probably just useless (if op can only be '&', '|' or '^'), > >>>no-one noticed it. > >>I guess it was to avoid a compiler warning such as > >> "case X not handled in switch" > > > >In such a case, a "default:" at the end with an assertion failure > >would have been better. > > No. An assertion only makes sense to make sure about what we aren't > entirely sure. In this case we are sure (that "default" never happens).
You are sure *now*. But imagine that in the future you modify the "if" at the beginning of the loop to add a 4th operator but you forget to modify the switch... BTW, since you are sure now and think an assert is useless anyway, removing the "default:" (or adding an empty "default:" at the end) now should be completely safe. -- Vincent Lefèvre <[email protected]> - Web: <http://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
