Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between RECTL and RECT?

Tags:

winapi

According to MSDN, RECT and RECTL are identical structures. Is there any difference between them at all and if not whats the point of having both of them instead of just one?

like image 475
user1934608 Avatar asked Jan 05 '13 14:01

user1934608


1 Answers

There's no difference between them, as documented in the MSDN article. To understand why they both exist, you have to go back in history, back to Windows version 3 and earlier. Those were 16-bit versions of Windows, unlike the versions of Windows that everybody uses today. The Windows SDK version for Windows 3.1 declared the RECT structure like this, in windows.h:

typedef struct tagRECT
{
    int left;
    int top;
    int right;
    int bottom;
} RECT;

And the ole2.h header file declared RECTL using long for the structure elements. 16-bit C and C++ compilers back then implemented int as a 16-bit type, fitting the word size of a 16-bit processor, and implemented long as a 32-bit type.

32-bit compilers, as used in modern Windows versions, made int a 32-bit type, fitting the word size of a 32-bit processor. And kept long as a 32-bit type. Which made the difference between the two structure types disappear.

like image 78
Hans Passant Avatar answered Oct 23 '22 13:10

Hans Passant