[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Small patch
From: |
Vincent Lefevre |
Subject: |
Re: [Tinycc-devel] Small patch |
Date: |
Thu, 31 Jan 2013 15:43:58 +0100 |
User-agent: |
Mutt/1.5.21-6295-vl-r57845 (2013-01-31) |
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 <address@hidden> - 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)
- Re: [Tinycc-devel] Small patch, (continued)
- Re: [Tinycc-devel] Small patch, Stephan Beal, 2013/01/31
- Re: [Tinycc-devel] Small patch, Thomas Preud'homme, 2013/01/31
- Re: [Tinycc-devel] Small patch, Thomas Preud'homme, 2013/01/31
- Re: [Tinycc-devel] Small patch, Vincent Lefevre, 2013/01/31
- Re: [Tinycc-devel] Small patch, grischka, 2013/01/31
- Re: [Tinycc-devel] Small patch, Vincent Lefevre, 2013/01/31
- Re: [Tinycc-devel] Small patch, grischka, 2013/01/31
- Re: [Tinycc-devel] Small patch,
Vincent Lefevre <=
- Re: [Tinycc-devel] Small patch, Michael Matz, 2013/01/31
- Re: [Tinycc-devel] Small patch, Vincent Lefevre, 2013/01/31
- Re: [Tinycc-devel] Small patch, grischka, 2013/01/31
Re: [Tinycc-devel] Small patch, Thomas Preud'homme, 2013/01/31