Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 748 Bytes

compiler-warning-level-2-c4308.md

File metadata and controls

29 lines (22 loc) · 748 Bytes
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Compiler Warning (level 2) C4308
Compiler Warning (level 2) C4308
08/30/2022
C4308
C4308
d4e5c53c-71b2-4bbc-8a7c-3a2a3180d9d9

Compiler Warning (level 2) C4308

negative integral constant converted to unsigned type

Remarks

An expression converts a negative integer constant to an unsigned type. The result of the expression is probably meaningless.

The /sdl (Enable Additional Security Checks) compiler option elevates this warning to an error.

Example

// C4308.cpp
// compile with: /W2
unsigned int u = (-5 + 3U);   // C4308

int main()
{
}