delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/13/15:31:13

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:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=k0+5ZHCsutR8o2RZ
NHAgAjw3K+/QEy83oLxPPj0Efla4/iazc9WeG0rNckZ8gp+1MLRxk0oOtKLUX8H1
OOwr21uNw75O1S84kNLOrBQ0YFwT4A1lxR+X4C5il4kA9glzRnTPOAy1LR8v4XL6
gS6VB1q0rs/oTuwRxQZk85bzP30=
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:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=MESlJU9nhAxaXiaO9Z2Fym
7JdRE=; b=hGMoRN+xVkERYWHOdf3eQW43sAsbiU+A2FZblYYnBnOoGEnAmYxI+Z
6BjMKj3cDKxlw+KtcghT55it+QKSn1sHrNScgYKact81Zv1wkAE2bQRBqumIOTDn
rCbw0X+NmoSUJpQCtB8lZtQxSTDAI0lm8XDrHrOvo18owYoz3NgAM=
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=bz0815tirolcom, bz0815 AT tirol DOT com, HContent-Language:en-CA, Hx-spam-relays-external:sk:smtp-ou
X-HELO: smtp-out-no.shaw.ca
X-Authority-Analysis: v=2.2 cv=M/89E24s c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=nXpHVBCWAAAA:8 a=8pif782wAAAA:8 a=eNdypJ0LU00hLmjAdYoA:9 a=QEXdDO2ut3YA:10 a=ef1U3j1GZOLCPeCgkYM6:22
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: Pthreads: Prototypes missing if -std=c11
To: cygwin AT cygwin DOT com
References: <mtranet DOT 20170713173633 DOT 1507674902 AT a1 DOT net>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Message-ID: <d2707e85-b3fb-91ad-c818-1b11cdebd33c@SystematicSw.ab.ca>
Date: Thu, 13 Jul 2017 13:30:53 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1
MIME-Version: 1.0
In-Reply-To: <mtranet.20170713173633.1507674902@a1.net>
X-CMAE-Envelope: MS4wfNKAk1/Lv1TM8FDzyOI/tTKPZtK2z5QY5Nb5N6VhGC1U5Qh9oLYk2LTDb90inejlmKCVXULhYgWF08htO4Om964G3qG8l57KHuvZq+NN/KeVdRCtp8Fq RypiBkmCkQGLWZCLnTE47V4PACetFS5PPCmXMmNFyswwkkHmT02T6c1KbqHuWQuWf/LdUbUYMvZCFQ==
X-IsSubscribed: yes

On 2017-07-13 09:36, bz0815 AT tirol DOT com wrote:
>> On 2017-07-12 11:15, bz0815 AT tirol DOT com wrote:
>>> gcc does not recognize some functions from pthread.h if option -std=c11
>>> is used:
>>
>> Exactly, and the same happens with glibc. When you use -std=c*, that means 
>> you are declaring strict ISO C, and all extensions are disabled by default 
>> unless explicitly enabled (e.g. with -D_POSIX_C_SOURCE=200112L).
>> 
>>  If you are not compatible with ISO C, then you should be using
>> -std=gnu* instead.

> Many thanks for the info, Yaakov. Accoring to the manual -std determines the 
> language standard and c11 means ISO C11, the 2011 revision of the ISO C 
> standard. Howevery, I find no restriction on POSIX in ISO/IEC 9899:2011. So
> why should -std=c11 have an influence on Pthreads? Am I missing something?
ISO/IEC 9899 specifies the features and facilities that shall or may be provided
by all standard conforming freestanding or hosted implementations. It considers
proposals from stakeholders for new language and library features based on
available implementations.

Threading is optional in standards conforming implementations: conforming
programs must compile cleanly if the feature is not available, and use only the
facilities declared in threads.h.
See https://en.wikipedia.org/wiki/C11_(C_standard_revision)#Optional_features

POSIX specifies common features and facilities that shall or may be provided by
one class of hosted implementations, with additional requirements to those
specified for standard conforming implementations.

POSIX does not provide threads.h but does provide pthreads.h, so you have a
choice, depending on whether you want to be strictly conforming or support POSIX.

See or search for Linux glibc man 7 feature_test_macros for more info about
macros and values.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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