delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/05/12/18:00:12

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:message-id:from:reply-to:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=grFF3l
if296JnQ6L1NMwgVt7VZWKTA/AU9WrBr9W2JBN3rCRWHQb7e7/Y4RCyB8ASrbQ8Z
scmBPW7BhizFlwmS51Kt7YBUl9UpeEB228qyQ8xCLiRlMq70S593NpkncR8oiF78
+hqKbY0L9xoSb1Ck8l5qF9s3wiWfe898rSAtk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:message-id:from:reply-to:to:subject
:references:in-reply-to:content-type; s=default; bh=6TZ4geKh7Gx9
02DAOJhaYtUuXL0=; b=Ku/FQauMag9b00go50+hq2Tk3AaleKgH6xsfh+7w8hc9
1kZbdc7AJzcoUAewXwcA7IR420qNNEhu8wk9zIg0gDC8+qPyL7DPhOh8uuRjUXUP
WmHa1z02PmjspXvyRUw8Y00Vw5fMCar6B3dL+4h4pTK3uL9xtH+UaZzT9GZhYA4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=
X-HELO: lb2-smtp-cloud9.xs4all.net
Date: Sun, 12 May 2019 23:59:55 +0200
Message-ID: <1dd675bf08f327d6bbe7b0912ba89821@smtp-cloud9.xs4all.net>
From: Houder <houder AT xs4all DOT nl>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: Why is __unix__ defined, and not __WINDOWS__ ?
References: <5fbb6229-da17-c056-19b9-9819c684a8ad AT agner DOT org>
In-Reply-to: <5fbb6229-da17-c056-19b9-9819c684a8ad@agner.org>
User-Agent: mua.awk 0.99

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

- Raw text -


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