I found this on Win32 docs:
// Check the smart card context handle. // hContext was set previously by SCardEstablishContext. LONG lReturn; lReturn = SCardIsValidContext(hContext); if ( SCARD_S_SUCCESS != lReturn ) { // Function failed; check return value. if ( ERROR_INVALID_HANDLE == lReturn ) printf("Handle is invalid\n"); else { // Some unexpected error occurred; report and bail out. printf("Failed SCardIsValidContext - %x\n", lReturn); exit(1); // Or other appropriate error action. } } else { // Handle is valid; proceed as needed. // ... }
The printf("Failed SCardIsValidContext - %x\n", lReturn);
line is passing an argument of type LONG
(typedef for long
) to printf
where printf
expects unsigned int
according to cppreference.com. Is this well defined behavior? If so, is it the same as an explicit static_cast
to unsigned int
?