Open irwir opened 10 months ago
Hi, it's not clear to me why you are proposing to use a format specifier for size_t
although the type of the varible is different (HWND). Moreover, it looks like the "z" modifier is only available since VS2019.
Maybe I should use PRIXPTR
for more portability across different VS versions (I think HWND is actually a pointer to an opaque struct)?
The latest standards have a few specific *ptr_t
types, but pointers used to be treated as size_t
values, and HWND is declared as a pointer.
PRIXPTR
looks good enough; only #include <inttypes.h>
has to be added. This macro did not exist in VS 6.0, but it was VC98 only.
https://github.com/ppescher/resizablelib/blob/8d6a0364f2730fdcbc398ab7ff045de7889fc1f5/ResizableLib/ResizableComboBox.cpp#L62
In case of 64-bit platform handle is 8 bytes long, while
X
format expects 4 bytes for an unsigned value. At leastzX
format is required forsize_t
(or MS-specificI64X
in 64-bit code). 8 bytes may need 16 hexadecimal digits, but output should not be truncated according to language standards.Possibly the line should be changed and then commented out as all other
TRACE
macros in the library code. //TRACE("ComboLBox: 0x%08zX\n", pWnd->m_hWnd);