This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add wrappers for ExitProcess, TerminateProcess


Christopher Faylor wrote:
> On Tue, Oct 06, 2009 at 03:51:26PM -0400, Charles Wilson wrote:
>> Having said all that, I really don't care one way or the other. We have
>> three possibilities:
>>
>> 1) current iteration (BOOL in cygwin_internal coerced to bool for static
>> function exit_process)
>> 2) use bool throughout exceptions.cc, and expect caller to use C++ bool,
>> C99 bool, or stdbool.h bool.
> 
> Since, as you say, we use DWORD in other places, I'm going to opt for
> what I originally proposed.  Change BOOL to bool since there is no reason
> to use the Windows API BOOL type.  Do that everywhere in your change that
> it makes sense.  Leave the UINT alone.

Hmm...this is interesting:

/usr/src/devel/kernel/src/winsup/cygwin/external.cc: In function 'long
unsigned int cygwin_internal(cygwin_getinfo_types, ...)':
/usr/src/devel/kernel/src/winsup/cygwin/external.cc:413: error: 'bool'
is promoted to 'int' when passed through '...'
/usr/src/devel/kernel/src/winsup/cygwin/external.cc:413: note: (so you
should pass 'int' not 'bool' to 'va_arg')
/usr/src/devel/kernel/src/winsup/cygwin/external.cc:413: note: if this
code is reached, the program will abort

This didn't happen with BOOL, because it is typedef int, anyway:

windef.h:

typedef unsigned long DWORD;
typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
/* FIXME: Is there a good solution to this? */
#ifndef XFree86Server
#ifndef __OBJC__
typedef WINBOOL BOOL;
#else
#define BOOL WINBOOL
#endif
typedef unsigned char BYTE;
#endif /* ndef XFree86Server */

So, to avoid requiring #include <windows.h>, I guess the next best thing
is option #3, right?

> 3) use bool in static function exit_process, use unsigned long in
> cygwin_internal and callers.

--
Chuck


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]