[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Small patch
From: |
Michael Matz |
Subject: |
Re: [Tinycc-devel] Small patch |
Date: |
Thu, 31 Jan 2013 15:56:34 +0100 (CET) |
User-agent: |
Alpine 2.00 (LNX 1167 2008-08-23) |
Hi,
On Thu, 31 Jan 2013, Vincent Lefevre wrote:
> > >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.
It will lead to slower and/or larger code to add a default case with a
separate body. The current way of doing it is IMO the exactly correct
way. If people are really confused by that, put a comment next to the
'default:'.
Generally stylistic "warnings" of coverity (and actually not just
stylistic things) have to be taken with a huge amount of salt.
Ciao,
Michael.
- 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, 2013/01/31
- Re: [Tinycc-devel] Small patch,
Michael Matz <=
- 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