Nóta
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as shíniú isteach nó eolairí a athrú.
Teastaíonn údarú chun rochtain a fháil ar an leathanach seo. Is féidir leat triail a bhaint as eolairí a athrú.
'identifier': conversion from 'type1' to 'type2', possible loss of data
Remarks
The types are different. Type conversion may result in loss of data. The compiler makes the type conversion.
This warning is off by default. For more information, see Compiler Warnings That Are Off by Default.
For more information on C4242, see Common Compiler Errors.
Example
The following example generates C4242:
// C4242.cpp
// compile with: /W4
#pragma warning(4:4242)
int func() {
return 0;
}
int main() {
char a;
a = func(); // C4242, return type and variable type do not match
}