Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax explanation using typedef

Tags:

c++

I want to understand why FAR is used in the below typedef syntax?

#define FAR
//some other instructions
//.....
//.....

typedef struct tagDEVICE_BUFFER_W
{
 ....
 ....
}DEVICE_BUFFER_W;

typedef DEVICE_BUFFER_W FAR * LPDEVICE_BUFFER_W; //Why FAR is used here?

What if I dont use FAR as mentioned below? Will it make any difference?

typedef DEVICE_BUFFER_W * LPDEVICE_BUFFER_W;
like image 543
Abhineet Avatar asked Aug 16 '26 14:08

Abhineet


1 Answers

It's legacy from the olden days. 16-bit Windows code had near and far pointers. I think it was to distinguish between inter-segment and intra-segment addressing, but the memory has faded (a lot).

like image 128
Marcelo Cantos Avatar answered Aug 18 '26 04:08

Marcelo Cantos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!