Compiler Warning (level 1) C4319
'~' : zero extending 'type1' to 'type2' of greater size
The result of the ~ (bitwise complement) operator is unsigned and then zero-extended when it is converted to a larger type.
Example
In the following example, ~(a - 1)
is evaluated as a 32-bit unsigned long expression and then converted to 64 bits by zero extension. This could lead to unexpected operation results.
// C4319.cpp
// compile with: cl /W4 C4319.cpp
int main() {
unsigned long a = 0;
unsigned long long q = 42;
q = q & ~(a - 1); // C4319 expected
}
Feedback
https://aka.ms/ContentUserFeedback.
În curând: Pe parcursul anului 2024, vom elimina treptat Probleme legate de GitHub ca mecanism de feedback pentru conținut și îl vom înlocui cu un nou sistem de feedback. Pentru mai multe informații, consultați:Trimiteți și vizualizați feedback pentru