Re: Why does Platform SDK define union LARGE_INTEGER in such a way?
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 06 Oct 2006 20:22:22 GMT
"Lighter" <cqulyx@xxxxxxxxx> writes:
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
Because the author(s) of that code don't care about portability. The
identifer _LARGE_INTEGER is reserved to the implementation (perhaps
the Platform SDK is part of the implementation?). Anonymous members
are not legal in standard C. The code assumes that the low-order half
is stored at the lowest address.
The typedefs (or are they macros?) ULONG, LONG, and LONGLONG are,
IMHO, horribly bad style. If they're always aliases for unsigned
long, long, and long long respectively, then the code should use
unsigned long, long, and long long. If they might sometimes refer to
other types, then the names ULONG, LONG, and LONGLONG are misleading.
Leaving that aside, I suppose the idea is that you can declare
and then refer to the numeric value as x.QuadPart, and to the
low-order half as either x.LowPart (non-portably) or x.u.LowPart
(portably, if you drop the anonymous structure from the union
declaration), and likewise for the high-order half.
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
- Prev by Date: Re: [OT] NULL and zeros
- Next by Date: Re: NULL and zeros
- Previous by thread: Re: Why does Platform SDK define union LARGE_INTEGER in such a way?
- Next by thread: Re: List files in current directory