public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Houder <houder@xs4all.nl>
To: cygwin@cygwin.com
Subject: Re: Why is __unix__ defined, and not __WINDOWS__ ?
Date: Sun, 12 May 2019 22:00:00 -0000	[thread overview]
Message-ID: <1dd675bf08f327d6bbe7b0912ba89821@smtp-cloud9.xs4all.net> (raw)
In-Reply-To: <5fbb6229-da17-c056-19b9-9819c684a8ad@agner.org>

On Sun, 12 May 2019 20:22:36, Agner Fog  wrote:
> I have noticed that the gcc and clang compilers have defined the 
> preprocessing macro __unix__, but not __WINDOWS__, _WIN32, or _WIN64 
> when compiling a windows executable.
> 
> Why is this?
> 
> A C/C++ program will check for these macros if it wants to know which 
> operating system you are compiling for, and this will give the wrong result.

Hans-Bernhard Bröker is correct ...

But if you were thinking of a "mixed" executable (be careful), then
the _WIN* mnemonics will be defined by gcc/g++.

(see the /include/w32api/{_mingw,_cygwin}.h headers)

Henri

64-@@ printf '#include <windows.h>' | gcc -dM -E - | grep -i win64
#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
#define _WIN64
#define __RPC_WIN64__
64-@@ printf '#include <windows.h>' | g++ -dM -E -x c++ - | grep -i win64
#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
#define _WIN64
#define __RPC_WIN64__

=====


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2019-05-12 22:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-12 18:22 Agner Fog
2019-05-12 19:52 ` Houder
2019-05-12 19:54 ` Hans-Bernhard Bröker
2019-05-12 20:29   ` Lee
2019-05-13  4:12   ` Agner Fog
2019-05-13  5:40     ` Brian Inglis
2019-05-13 14:49       ` Agner Fog
2019-05-13 16:16         ` Yaakov Selkowitz
2019-05-13  7:56     ` Soegtrop, Michael
2019-05-12 20:33 ` Mike Gran via cygwin
2019-05-12 20:54   ` Houder
2019-05-13  4:40     ` Brian Inglis
2019-05-13 10:04       ` Houder
2019-05-12 22:00 ` Houder [this message]
2019-05-12 23:12   ` Houder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1dd675bf08f327d6bbe7b0912ba89821@smtp-cloud9.xs4all.net \
    --to=houder@xs4all.nl \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).