I was diving into the Win32 API documentation and I noticed that the POINT structure has a note saying it's identical to the POINTL structure. Can anyone explain why POINTL exists if it serves the same purpose as POINT?
9 Answers
c
I
r
Honestly, I can't say for sure, but I believe in the Win16 API, `POINT` was just an alias for the `POINTS` structure, not for `POINTL`. If you want long integers, go for `POINTL`, and if you’re looking for short integers, use `POINTS`. For general purposes, stick with `POINT`. Although, things were a lot simpler back in those days!
C
I think the 'L' in `POINTL` stands for 'long'. The `POINT` structure likely had varying member data types in the past, which could change depending on the architecture. So, if you need long values, `POINTL` is your go-to!
a
The different widths in the `POINT` structure across various Windows versions are the reason behind the existence of `POINTL`. Back in the day, like on 16-bit Windows 3, the fields were 16-bit integers, but then they switched to 32-bit integers in 32-bit Windows. So, `POINTL` was introduced to use `LONG` types for consistency across different C implementations. This was important because the size of `int` could vary, causing potential compatibility issues in code. It's a bit messy, but it helps maintain support for older programs!
{
You’re right about that; back in the Win16 API, we only had `POINT`, and GDI was limited to a max of 32767x32767, so there wasn’t really any need for `POINTL` or `POINTS`. Those were simpler times!