Boost logo

Boost :

Subject: Re: [boost] [warnings] Are warnings acceptable artifactsfrom builds?
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2009-09-08 23:12:28


On Tue, Sep 8, 2009 at 8:19 PM, Thomas
Klimpel<Thomas.Klimpel_at_[hidden]> wrote:
> Michael Fawcett wrote:
>> Well, it's right.  That's a constant conditional expression.
>
> You're trying to tease me, right?

No, sorry if I came off that way.

>> You can
>> either ignore the warning or put it in a template specialization which
>> would get rid of the warning.  Is it defined in the standard that the
>> conditional will *always* get optimized away?  If it isn't, that seems
>> like a reasonable warning.
>
> MSVC explicitly says whether a warning is just a performance warning, and C4127 is not a performance warning. It is a warning to inform the programmer about a possible mistake (IIRC, if(true) or if(false) don't trigger this warning). I don't understand what you mean by "... or put it in a template specialization which would get rid of the warning". Are you suggesting I should try to emulate the optimizer of the compiler, even if this would imply substantial code duplication?

I agree it's annoying. I'm curious (in the sense that I have no clue
what the answer is)...does MSVC generate the code in the else block
when it gives that warning?

>> I don't think that works with templates.  Typically to silence errors
>> in template code, the user must put those pragmas around the point of
>> instantiation.
>
> I hope you're joking.

I wish. That's how it works with MSVC though.

>> The warnings I saw were int->bool, bool->int conversions, unused
>> parameters, and struct now seen as class.
>>
>> I agree some warnings are nonsense, but there are some cases (just
>> mentioned) that should be silenced by proper code changes.
>
> Agreed.
>
>
>> I don't think a strict "no warning" policy needs to be in place, which
>> I think is what Emil is against, but I think Boost should strive to
>> have as few as possible and there's too much low hanging fruit waiting
>> to be picked currently (causing lots of noise).
>
> Agreed.

I think everyone can agree that Boost should strive for as few
warnings as possible, but forcing all libraries to be warning free on
all compilers is close to impossible.

--Michael Fawcett


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk