Re: Why does Platform SDK define union LARGE_INTEGER in such a way?
- From: "Alex Blekhman" <xfkt@xxxxxxxxx>
- Date: Fri, 6 Oct 2006 12:03:58 +0200
"Lighter" wrote:
Why does Platform SDK define union LARGE_INTEGER in such a way?
ntdef.h defines the union LARGE_INTEGER as follows:
typedef union _LARGE_INTEGER
{
struct
{
ULONG LowPart;
LONG HighPart;
};
struct
{
ULONG LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER;
Though I fully understand what union is, I cannot think out the reason
why it adds struct u into the union. In fact, the struct u is
equivalent to the unnamed struct, so we can alway use the unnamed
struct instead of struct u. To my thinking, the union should be
designed as follows:
typedef union _LARGE_INTEGER
{
struct
{
ULONG LowPart;
LONG HighPart;
};
LONGLONG QuadPart;
} LARGE_INTEGER;
Am I right?
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.)?
I think, in the beginning LARGE_INTEGER was defined as you described. Then Platform SDK team discovered that not all compilers (or compiler switches) will be able to handle unnamed nested struct. So, they added `u' member.
.
- References:
- Prev by Date: Re: How to elegantly store (and load) a string to (from) a file in binary mode?
- Next by Date: Re: Why does Platform SDK define union LARGE_INTEGER in such a way?
- Previous by thread: Re: Why does Platform SDK define union LARGE_INTEGER in such a way?
- Next by thread: CDialog Close Parent
- Index(es):
Relevant Pages
|