Macros __MINGW32__ AND __MINGW64__

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Macros __MINGW32__ AND __MINGW64__

Earnie Boyd
To help document with less typing, I would like to suggest we also
introduce __MINGW__ for when the declarations and definitions are for
both __MINGW32__ and __MINGW64__ rather than the longer construct of
#if defined(__MINGW32__) || defined(__MINGW64__) we can then instead
say #ifdef __MINGW__.  We could add the following to _mingw.h:

#if defined(__MINGW32__) || defined(__MINGW64__)
#define __MINGW__
#endif

Or perhaps we can influence a patch to GCC when either is defined
__MINGW__ is also defined.

Comments?

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
MinGW-dvlpr mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr
Reply | Threaded
Open this post in threaded view
|

Re: Macros __MINGW32__ AND __MINGW64__

waterlan
Op 29-6-2012 15:32, Earnie Boyd schreef:

> To help document with less typing, I would like to suggest we also
> introduce __MINGW__ for when the declarations and definitions are for
> both __MINGW32__ and __MINGW64__ rather than the longer construct of
> #if defined(__MINGW32__) || defined(__MINGW64__) we can then instead
> say #ifdef __MINGW__.  We could add the following to _mingw.h:
>
> #if defined(__MINGW32__) || defined(__MINGW64__)
> #define __MINGW__
> #endif
>
> Or perhaps we can influence a patch to GCC when either is defined
> __MINGW__ is also defined.
>
> Comments?
>

Hi,

Not needed. MinGW-w64 defines both __MINGW32__ and __MINGW64__, so
__MINGW32__ only will work for both mingw and mingw-w64.

This is very handy when writing portable software, because mingw-w64
automatically gets all the __MINGW32__ stuff which is often also good
for mingw-w64. You only need __MINGW64__ when the code needs to be
different for 64 bit compared to 32 bit.

Similarly mingw-w64 also defines WIN32, _WIN32, __WIN32, and __WIN32__
(next to WIN64, _WIN64, __WIN64, and __WIN64__).

regards,

--
Erwin Waterlander
http://waterlan.home.xs4all.nl/


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
MinGW-dvlpr mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr
Reply | Threaded
Open this post in threaded view
|

Re: Macros __MINGW32__ AND __MINGW64__

Earnie Boyd
On Fri, Jul 20, 2012 at 3:36 PM, Erwin Waterlander wrote:

> Op 29-6-2012 15:32, Earnie Boyd schreef:
>> To help document with less typing, I would like to suggest we also
>> introduce __MINGW__ for when the declarations and definitions are for
>> both __MINGW32__ and __MINGW64__ rather than the longer construct of
>> #if defined(__MINGW32__) || defined(__MINGW64__) we can then instead
>> say #ifdef __MINGW__.  We could add the following to _mingw.h:
>>
>> #if defined(__MINGW32__) || defined(__MINGW64__)
>> #define __MINGW__
>> #endif
>>
>> Or perhaps we can influence a patch to GCC when either is defined
>> __MINGW__ is also defined.
>>
>> Comments?
>>
>
> Hi,
>
> Not needed. MinGW-w64 defines both __MINGW32__ and __MINGW64__, so
> __MINGW32__ only will work for both mingw and mingw-w64.
>

I'm not concerned about what mingw-w64 does, I'm concerned more about
what we will do.

> This is very handy when writing portable software, because mingw-w64
> automatically gets all the __MINGW32__ stuff which is often also good
> for mingw-w64. You only need __MINGW64__ when the code needs to be
> different for 64 bit compared to 32 bit.

And this construct is confusing.  My query is more to help with self
documenting such that __MINGW32__ || __MINGW64__ becomes __MINGW__
alone.  But now I'm thinking that we want to just use __MINGW__ and
not define __MINGW32__ or __MINGW64__ similar to the __CYGWIN__ issue.
 We can always compare _WIN32 or _WIN64 when that bit difference is
needed.  So if it is 64bit only and combined with MinGW specifics we
would do __MINGW__ && _WIN64.

>
> Similarly mingw-w64 also defines WIN32, _WIN32, __WIN32, and __WIN32__
> (next to WIN64, _WIN64, __WIN64, and __WIN64__).

These are actually defined in GCC.

--
Earnie
-- https://sites.google.com/site/earnieboyd

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
MinGW-dvlpr mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr