From: Luke D. <cod...@ho...> - 2003-01-20 09:56:06
|
----- Original Message ----- From: "Jerry van Dijk" <jv...@at...> To: <min...@li...> Sent: Saturday, January 18, 2003 1:58 AM Subject: [MinGW-dvlpr] W32API header question > I am looking closely at the W32API headers for conversion > into Ada. I ran into the following (from winnt.h): > > typedef union _LARGE_INTEGER { > struct { > DWORD LowPart; > LONG HighPart; > } u; > #if ! defined(NONAMELESSUNION) || defined(__cplusplus) > _ANONYMOUS_STRUCT struct { > DWORD LowPart; > LONG HighPart; > }; > #endif /* NONAMELESSUNION */ > LONGLONG QuadPart; > } LARGE_INTEGER, *PLARGE_INTEGER; > > What is the purpose of the _ANONYMOUS_STUCT (or UNION) If you have a LARGE_INTEGER variable "foo", it allows you to use a shorthand "foo.LowPart" instead of "foo.u.LowPart". This is necessary because MSDN says it is. > and > why is it only defined for c++ ? Note the "||". It is defined for both C++, and for C unless NONAMELESSUNION is defined. Anonymous unions and structs are apparently always supported in C++, but I think some older versions of GCC didn't support them so the headers check for NONAMELESSUNION. If you are talking about just the _ANONYMOUS_STRUCT symbol itself, see windef.h and the GCC documentation for __extension__: it is necessary to suppress warnings when compiling with -pedantic. > > -- Jerry van Dijk | email: jd...@ac... > -- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk Luke |