Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I found these links on MSDN(Implementation of LARGE_INTEGER & ULARGE_INTEGER)
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383713(v=vs.85).aspx[^]
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383742(v=vs.85).aspx[^]
typedef union _LARGE_INTEGER {
  struct {
    DWORD LowPart;
    LONG  HighPart;
  };
  struct {
    DWORD LowPart;
    LONG  HighPart;
  } u;
  LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;


Who can tell me what the consideration for the former definition is,
and what does it mean by the struct name "u" (means "unsigned" ?, I'm
not sure.)? and Why/Where should we use LARGE_INTEGER instead of _int64
Thanks in advance
Posted

1 solution

Firstly the structure u seems redundant. Microsoft supports anonymous structures: http://msdn.microsoft.com/en-us/library/z2cx9y4f.aspx[^]

Thus in a Microsoft environment you could write:
C#
LARGE_INTEGER li;
li.LowPart = 1;


This is non-portable so to make it portable the named structure u is added. Now you can write:

C++
li.u.LowPart = 1;


Use it where _int64 is not supported.
 
Share this answer
 
v3
Comments
Buddhi Chaturanga 21-Nov-14 4:09am    
Thanks for the quick reply.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900