lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] More enabled warnings, less boost


From: Vadim Zeitlin
Subject: Re: [lmi] More enabled warnings, less boost
Date: Mon, 6 Feb 2017 18:58:44 +0100

On Mon, 6 Feb 2017 15:35:42 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2017-02-06 15:05, Vadim Zeitlin wrote:
GC> > On Sun, 5 Feb 2017 12:31:19 +0000 Greg Chicares <address@hidden> wrote:
GC> > 
GC> > GC> On 2017-02-04 22:16, Vadim Zeitlin wrote:
GC> > GC> > On Sat, 4 Feb 2017 19:12:23 +0000 Greg Chicares <address@hidden> 
wrote:
...
GC> > GC> But they don't, because we have '-Wno-conversion' due to boost.
GC> > 
GC> >  It's indeed a pity to have to disable this warning globally. Now that we
GC> > use Boost in fewer places than before and we require a sufficiently new
GC> > compiler, could we perhaps use GCC diagnostic push/ignored/pop pragmas to
GC> > disable the warning just in the Boost headers it appears in instead of
GC> > doing it everywhere?
GC> > 
GC> >  Please let me know if you'd like me to [try to] do this,
GC> 
GC> No, thanks. I already tried those pragmata. I wrote them around
GC> calls to boost facilities. I wrote them around inclusions of
GC> boost headers. I still got the same number of lines of compiler
GC> diagnostics (8932 lines or so). Searching the web, all signs
GC> point to an open defect on gcc's bugzilla.

 I couldn't find any bugs related to this, could you please give a link to
this one?

GC> So I took a different approach. Here's one thing that helped:
GC> 
GC>   -DBOOST_STATIC_ASSERT_HPP \
GC>   -D'BOOST_STATIC_ASSERT(A)=static_assert((A),"")' \
GC> 
GC> If that tickles your fancy, I'm willing to share the whole set
GC> of changes with you,

 The simplest would be to commit them to some experimental/Wconversion
branch in the git repository, then I could not only look at it, but it
would also make working on it and completing these changes easier in the
future.

GC> If you still want to see the changes, there are some items on
GC> which you might like to opine, e.g.:
GC> 
GC>     int cents() const
GC>         {
GC> //      return cents_ % cents_per_dollar;
GC>         // C++11 [5.6/4]: "if the quotient a/b is representable in the
GC>         // type of the result, (a/b)*b + a%b is equal to a"
GC>         return static_cast<int>(cents_ - (cents_ / cents_per_dollar) * 
cents_per_dollar);
GC>         }

 I don't understand how is this preferable to

        return static_cast<int>(cents_ % cents_per_dollar);

?

GC> Maybe I should have used modf() or fmod(), but that would
GC> have required too much thought for this quick exercise.

 I don't see how would it have helped neither, to be honest?

 Regards,
VZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]