Compiler Warning (level 4) C4245
'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
You tried to convert a signed const
type that has a negative value to an unsigned
type.
The following sample generates C4245:
// C4245.cpp
// compile with: /W4 /c
const int i = -1;
unsigned int j = i; // C4245
const int k = 1;
unsigned int l = k; // okay
int m = -1;
unsigned int n = m; // okay
void Test(size_t i) {}
int main() {
Test( -19 ); // C4245
}
คำติชม
https://aka.ms/ContentUserFeedback
เร็วๆ นี้: ตลอดปี 2024 เราจะขจัดปัญหา GitHub เพื่อเป็นกลไกคำติชมสำหรับเนื้อหา และแทนที่ด้วยระบบคำติชมใหม่ สำหรับข้อมูลเพิ่มเติม ให้ดู:ส่งและดูข้อคิดเห็นสำหรับ