Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
warning C28715: Cast between semantically different integer types
This warning indicates that a Boolean is being cast to NTSTATUS. This is likely to give undesirable results. For example, the typical failure value for functions that return a Boolean (FALSE) is a success status when tested as an NTSTATUS.
Typically, a function that returns Boolean returns either 1 (for TRUE) or 0 (for FALSE). Both these values are treated as success codes by the NT_SUCCESS macro. Thus, the failure case will never be detected.
Examples
PREfast reports the warning for the following example.
extern BOOL SomeFunction(void);
if (NT_SUCCESS(SomeFunction())) {
return 0;
} else {
return -1;
}
The following example avoids the error.
extern BOOL SomeFunction(void);
if (SomeFunction() == TRUE) {
return 0;
} else {
return -1;
}