X-Recipient: archive-cygwin@delorie.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:from:reply-to:to:subject:message-id
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=BxdwZGCDqfWkqukh7gxT5AedmNrVS7ly3JLNK27qNhhQ2MGaCW05o
	DovyQZ7z3G3kMwIPmCjFMu/W0G4TOm986JkJXtunnAFW5gntbsFPkk3ZzLHFXTHh
	5qEr/NgnKZ1RxOVPM/nLMBNmca1jOhmjhhLDu8SBrWiuQ4awd6FwoY=
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:from:reply-to:to:subject:message-id
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=Pm6M5jFbtsKu6xteng5aLBJ9lWw=; b=HhV2O+JrqlcMW/7yIHeAJYystFBL
	a8LOPmIWY1CIn1FwQoQ2c1qOW0DZkC4i6EPQF4feqN4asFXg9Up9AksEbECrM52G
	1nUHrQi36gPf6F1YXzsyrS5h2rry0DeqEHoR9XdF1UsqSZ+wA1uoSX/QZLyXyrQN
	dakW8CeF4e94t8o=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=gran, Gran, Mike, somebody
X-HELO: sonic315-14.consmr.mail.bf2.yahoo.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1557693220; bh=9hvC9Oa+ES1m+Q0hW9LJxWNK/tTR4LzogJXPZ21zoz8=; h=Date:From:To:Subject:References:In-Reply-To:From:Subject; b=heD+a8ecYFD66pbxDhOiACx7h5P2EUk6erbnIcCVehiDW4A6ZvAFjU0tR5DeOWhGPehwEIqLxbDBaPkkY09jVsZUJniWcnfmhJB+u4dVophOtDkqTsFi8h1jj4V2e8zpOvkqyvHrDdOc+ZYnWa8nOkcrqQHA8WLnFBBGEtGHY8UesquyX7rC+BGuEiHhY5tFWPoA/0eDb6KbMI1NUcBK4JHMutnWIq5mJ2r/RXpERQ5lminwmvhdwVKp6S1QCXhRHT15FeZsUREkGVkafHZyITZ52rbr1elk40n8QA+p4gF4fyk9OnPBzXRFhtihLahiZhPgxE0fnF3sG7WJhkYn0g==
Date: Sun, 12 May 2019 13:33:30 -0700
From: "Mike Gran via cygwin" <cygwin@cygwin.com>
Reply-To: Mike Gran <spk121@yahoo.com>
To: cygwin@cygwin.com
Subject: Re: Why is __unix__ defined, and not __WINDOWS__ ?
Message-ID: <20190512203330.GA30710@spikycactus.attlocal.net>
References: <5fbb6229-da17-c056-19b9-9819c684a8ad@agner.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <5fbb6229-da17-c056-19b9-9819c684a8ad@agner.org>
User-Agent: Mutt/1.11.3 (2019-02-01)
X-IsSubscribed: yes

On Sun, May 12, 2019 at 08:22:36PM +0200, 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?

As I understand it, when using the cygwin compiler to compile for the
cygwin target, these defines are intentionally not defined, because
Cygwin is supposed to look and feel like a Posix platform, not a
windows one.

The various MinGW compilers do define these constants because the target
is native windows.

I think these days the canonical defines are (somebody correct me if
I'm wrong)

  __CYGWIN__ for Cygwin

  _WIN32 as 1 on MinGW when the compilation target is Windows 32-bit
  ARM, 64-bit ARM, x86, or x64. Otherwise, undefined.

  _WIN64 as 1 on MinGW when the compilation target is Windows 64-bit
  ARM or x64. Otherwise, undefined

I am not a maintainer.

-
Mike Gran
 

--
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

