W8041 Negating unsigned value (C++)

From RAD Studio
Jump to: navigation, search

Go Up to Compiler Errors And Warnings (C++) Index

(Command-line option to suppress warning: -w-ngu)

Basically, it makes no sense to negate an unsigned value because the result will still be unsigned.

Example:

#pragma warn +ngu
unsignedfoo(unsigned u)
{
return-u;
}