unary minus operator applied to unsigned type, result still unsigned?

From: Philip Oakley <hidden>
Date: 2016-06-16 02:19:11

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help