This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: B20.1: typedef for DWORDLONG



<inline>
-----Original Message-----
From: jmm@raleigh.ibm.com <jmm@raleigh.ibm.com>
To: cygwin@sourceware.cygnus.com <cygwin@sourceware.cygnus.com>
Date: Friday, February 05, 1999 9:21 AM
Subject: B20.1: typedef for DWORDLONG


>I've never done Win32-based programming before and I'm having to modify
>someone else's NT 4.0 app to do some signal handling and noticed that
>while trying to compile with B20.1, their code uses DWORDLONG as a 
>64-bit integer type (appears to be equiv to LONGLONG I think?).  Thinking
>maybe it was just their bad programming, I pulled up MS's Visual C++
>5.0 and sure enough their code examples use DWORDLONG as a 64-bit
>integer type as well.


In the Microsoft Windows headers, a DWORDLONG is typedefed to be a 
ULONGLONG, which is an unsigned __int64 (for the Microsoft compiler).
(You can find the definition in <winnt.h>, if you have a copy of the
Microsoft headers).

For Cygwin this should do what you need:

    typedef unsigned long long DWORDLONG;

>B20.1's windows32/base.h typedef's it as a double, which considering DWORD
>is an unsigned int, doesn't make sense to me.  Am I missing something
>about the type assignments (coming from Linux development, it's weird
>not to use int, long, long long, but I'm trying not to re-type everything
>in this whole app just to work with B20.1 :)
>
>Thanks,

>
>James Manning
>-- 
>Hardware Design Engineer --- IBM Netfinity Performance Development
>
>--   
>Want to unsubscribe from this list?                             
>Send a message to cygwin-unsubscribe@sourceware.cygnus.com

It's typedefed as a double?  Interesting... (It's been too long since I
looked at what Cygwin supported "out of the box"...)

There is a reason for this, however.  LONGLONG and its family expect
a 64-bit integer.  If the compiler doesn't support 64-bit integers, 
(or more specifically, if the compiler doesn't support the __int64 type) 
the fallback is to use a double, which is the same size (for use
in stack alignment, anyway).

I'm not sure why the GNU headers weren't updated to use a "long long" 
instead of a double, though...

 - Jon


--   
Want to unsubscribe from this list?                             
Send a message to cygwin-unsubscribe@sourceware.cygnus.com