lmi
[Top][All Lists]
Advanced

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

Re: [lmi] MSVC warnings [all but TOMS 748]


From: Vadim Zeitlin
Subject: Re: [lmi] MSVC warnings [all but TOMS 748]
Date: Thu, 16 Jun 2022 02:33:09 +0200

On Tue, 7 Jun 2022 23:12:15 +0000 Greg Chicares <gchicares@sbcglobal.net> wrote:

GC> I'm willing to disable the warning and write commentary, if you
GC> would please tell me what msvc pragma to write.

 I've done this in https://github.com/let-me-illustrate/lmi/pull/219 which
corresponds to xanadu/msvc-avoid-neg-warn branch, please let me know if you
have any questions.

 As an aside, I'd like to note that I have yet another confirmation of the
fact that using unary minus with unsigned variables is confusing and the
proof is that you've left a cast in this expression:

    return (t < 0) ? static_cast<U>(-u) : u;

where it is actually completely superfluous, because applying this operator
to "u" already yields a value of type "U". Of course, this is a very simple
mistake to make because it's intuitively clear (yet wrong) that applying
the minus operator should yield a signed value. So while I won't return to
this again (unless I forger that I decided not to do it, of course, as
might have already happened...), I'll continue to avoid using this operator
with the unsigned variables in my own code because it is too misleading as
absolutely everybody reads it as "minus" and not as "additive inverse".

 Regards,
VZ

Attachment: pgpQMN3u15qxH.pgp
Description: PGP signature


reply via email to

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