From: "Philip Oakley" <philipoakley@iee.org>
To: "Git List" <git@vger.kernel.org>
Subject: unary minus operator applied to unsigned type, result still unsigned?
Date: Wed, 4 May 2016 23:59:23 +0100 [thread overview]
Message-ID: <74B59A4DF45C45AF9CDCF6662DDAEF1E@PhilipOakley> (raw)
I'm working on building Git on Visual Studio as part of the Git for Windows
capability.
The MSVC compiler is reporting:
1>..\sha1-lookup.c(100) : warning C4146: unary minus operator applied to
unsigned type, result still unsigned
1>..\sha1-lookup.c(316) : warning C4146: unary minus operator applied to
unsigned type, result still unsigned
the two lines of code are the same, and the message suggests a bad return
value:
#100: return -lo-1;
#316: return -lo-1;
Should these be protected by an appropriate brackets/calculation (-1-lo) ?
Or does
gcc use an alternate assumption about unary minus conversion for functions
returning int?
--
Philip
next reply other threads:[~2016-05-04 22:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-04 22:59 Philip Oakley [this message]
2016-05-04 23:19 ` unary minus operator applied to unsigned type, result still unsigned? Junio C Hamano
2016-05-05 21:39 ` Philip Oakley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=74B59A4DF45C45AF9CDCF6662DDAEF1E@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox