www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/10/31/10:55:41

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <iajv3i$6fu$1@dough.gmane.org>
References: <iajqhl$kq7$1 AT dough DOT gmane DOT org> <4CCD72FF DOT 1000901 AT aol DOT com> <iajv3i$6fu$1 AT dough DOT gmane DOT org>
Date: Sun, 31 Oct 2010 14:55:29 +0000
Message-ID: <AANLkTin1YBWrZe+GCzGA06J+AVC6BpovyxcFSbDvn45F@mail.gmail.com>
Subject: Re: Cygwin c compiler and c99
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On 31 October 2010 14:39, David wrote:
> By adding #include <stdbool.h> it worked.
>
> Den 31-10-2010 14:45, Tim Prince skrev:
>>
>> On 10/31/2010 6:21 AM, David wrote:
>>>
>>> Does Cygwin c compiler not support c99?
>>> or does c99 not support?:
>>>
>>> #include <stdio.h>
>>> #include <stdlib.h>
>
> #include <stdbool.h>
>>>
>>> int main(void) {
>>> bool f=true;
>>> for(int i=0; i<10; i++) {
>>> if (f)
>>> printf("%d\n",i);
>>> }
>>> puts("Hello World!!!"); /* prints Hello World!!! */
>>> return EXIT_SUCCESS;
>>> }
>>>
>
>
> But why do I have to include <stdbool.h>?

Because 'bool', 'true' and 'false' are not defined in the C99
language, but in the C99 library, as macros in the stdbool.h header.
The language only defines the type _Bool with vaues 0 and 1.

See also:
http://www.codinghorror.com/blog/2008/03/the-first-rule-of-programming-its-always-your-fault.html

Andy

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