www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/05/01/06:30:05

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
Message-ID: <3CCFC32B.3DF7AD12@yahoo.com>
Date: Wed, 01 May 2002 06:27:55 -0400
From: Earnie Boyd <earnie_boyd AT yahoo DOT com>
X-Accept-Language: en
MIME-Version: 1.0
To: Danny Smith <danny_r_smith_2001 AT yahoo DOT co DOT nz>
CC: cygwin-apps <cygwin-apps AT cygwin DOT com>,
mingw-dvlpr <mingw-dvlpr AT lists DOT sourceforge DOT net>
Subject: Re: [MinGW-dvlpr] [w32api] : Move anonymous struct/union defines out of
windows.h
References: <20020501022052 DOT 7401 DOT qmail AT web14502 DOT mail DOT yahoo DOT com>

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!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019