www.delorie.com/archives/browse.cgi | search |
Fine by me. Earnie. Danny Smith wrote: > > Hello > > Can any one see any problems with moving this block of defines: > > #ifdef __GNUC__ > #ifndef NONAMELESSUNION > #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) > #define _ANONYMOUS_UNION __extension__ > #define _ANONYMOUS_STRUCT __extension__ > #else > #if defined(__cplusplus) > #define _ANONYMOUS_UNION __extension__ > #endif /* __cplusplus */ > #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */ > #endif /* NONAMELESSUNION */ > #elif defined(__WATCOMC__) > #define _ANONYMOUS_UNION > #define _ANONYMOUS_STRUCT > #endif /* __GNUC__/__WATCOMC__ */ > > #ifndef _ANONYMOUS_UNION > #define _ANONYMOUS_UNION > #define _UNION_NAME(x) x > #define DUMMYUNIONNAME u > #define DUMMYUNIONNAME2 u2 > #define DUMMYUNIONNAME3 u3 > #define DUMMYUNIONNAME4 u4 > #define DUMMYUNIONNAME5 u5 > #define DUMMYUNIONNAME6 u6 > #define DUMMYUNIONNAME7 u7 > #define DUMMYUNIONNAME8 u8 > #else > #define _UNION_NAME(x) > #define DUMMYUNIONNAME > #define DUMMYUNIONNAME2 > #define DUMMYUNIONNAME3 > #define DUMMYUNIONNAME4 > #define DUMMYUNIONNAME5 > #define DUMMYUNIONNAME6 > #define DUMMYUNIONNAME7 > #define DUMMYUNIONNAME8 > #endif > #ifndef _ANONYMOUS_STRUCT > #define _ANONYMOUS_STRUCT > #define _STRUCT_NAME(x) x > #define DUMMYSTRUCTNAME s > #define DUMMYSTRUCTNAME2 s2 > #define DUMMYSTRUCTNAME3 s3 > #else > #define _STRUCT_NAME(x) > #define DUMMYSTRUCTNAME > #define DUMMYSTRUCTNAME2 > #define DUMMYSTRUCTNAME3 > #endif > > #ifndef NO_STRICT > #ifndef STRICT > #define STRICT 1 > #endif > #endif > > from windows.h to windef.h, which is the first w32api header that > windows.h includes. Thus anything that includes <windows.h> to get these > defines will still get them through windef.h > > Why? Often (specifically, in g++-v3 header gthr-win32.h, which is included > by STL userland headers to get inlined TLS functions) user only needs > the windef.h, winnt.h and winbase.h w32api declarations and defines. Doing > this: > > #include <stdarg.h> > #include <windef.h> /* includes winnt.h and winerror.h */ > #include <winbase.h> > #ifdef __cplusplus > extern "C" > #endif > DWORD WINAPI GetLastError(void); /* from winuser.h */ > > is much preferable to: > > #include <windows.h>, even if we do the sort of MEANER_AND_LEANER dance > that winsup.h does. > > The anonymous union/structure business is needed in winnt.h and > elsewhere. I can't find any MSDN documnetation that says they should be in > windows.h, though > > Danny > > http://messenger.yahoo.com.au - Yahoo! Messenger > - A great way to communicate long-distance for FREE!
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |