[PATCH] get rid of windows C4146 warning in MathExtras.h

Peng Cheng gm4cheng at gmail.com
Wed Feb 27 06:28:03 PST 2013


Suppressing warning was the my first attempt to fix this warning, and just
as Aaron said, the warning suppressing was added into multiple places,
looking ugly.

The attached patch is the second attempt,  People, who wrote "-Val" with
"Val" as unsigned , normally understand this change with the original code
as comments as Aaron suggests.

-Peng

On Wed, Feb 27, 2013 at 8:34 AM, Aaron Ballman <aaron at aaronballman.com>wrote:

> On Wed, Feb 27, 2013 at 8:08 AM, Duncan Sands <baldrick at free.fr> wrote:
> > Hi Peng,
> >
> >
> >> See detals at http://msdn.microsoft.com/en-us/library/4kh09110.aspx
> >
> >
> > I see, thanks.  Can't you just suppress the warning instead?  The current
> > code
> > is correct, and your proposed fix makes the code too hard to read IMO.
>
> I'm on the fence.  Suppressing warnings makes the code just as ugly
> (we don't want to apply the suppression to the entire file, so it
> means we have to add it three places), but this code is certainly
> harder to understand than the original code.
>
> I wonder if we could leave the original code in as comments explaining
> Peng's code?  I usually abhor that even more than ugly code since it
> can get out of whack, but I don't see this code being modified that
> often either.
>
> ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130227/886edb91/attachment.html>


More information about the llvm-commits mailing list