delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2015/06/06/09:15:09

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Kaz Kylheku (kaz AT kylheku DOT com)" <djgpp AT delorie DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP v2.05: some thoughts
Date: Sat, 6 Jun 2015 12:59:47 +0000 (UTC)
Organization: Aioe.org NNTP Server
Lines: 47
Message-ID: <20150606054809.810@kylheku.com>
References: <55673F0B DOT 1090103 AT iki DOT fi> <83twuwwshg DOT fsf AT gnu DOT org>
<55675040 DOT 9030008 AT iki DOT fi> <556F6E49 DOT 8010006 AT gmx DOT de>
<556FCCDF DOT 7080005 AT iki DOT fi> <83bngvr0ef DOT fsf AT gnu DOT org>
<557078B1 DOT 9040004 AT iki DOT fi> <201506041613 DOT t54GDT8m014488 AT delorie DOT com>
<5570B1F7 DOT 1070509 AT iki DOT fi> <83pp5aprqw DOT fsf AT gnu DOT org>
NNTP-Posting-Host: OGJi3KNpFOhM58UHZwXj0w.user.speranza.aioe.org
X-Complaints-To: abuse AT aioe DOT org
User-Agent: slrn/pre1.0.0-18 (Linux)
X-Notice: Filtered by postfilter v. 0.8.2
Bytes: 2803
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On 2015-06-05, Eli Zaretskii (eliz AT gnu DOT org) <djgpp AT delorie DOT com> wrote:
>> Date: Thu, 04 Jun 2015 23:15:51 +0300
>> From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi)" <djgpp AT delorie DOT com>
>> #endif /* (__STDC_VERSION__ >= 199901L) || !__STRICT_ANSI__ */
>> 
>> -#ifndef __STRICT_ANSI__
>> +#if !defined(__STRICT_ANSI__) || defined(__cplusplus)
>> 
>> #define E2BIG          3
>> #define EACCES         4
>
> This looks wrong: we shouldn't have errno values visible under ANSI
> compilation which are not defined by the ANSI C standard.  E.g., C99
> only defines EDOM, EILSEQ, and ERANGE.

I do not agree.

The purpose of --ansi (or other C dialect selectors) is to affect the
C dialect used, not the libraries (which are not even part of GCC).

When I use -ansi, I want GCC not to accept nonconforming extensions.

I do not want it to start hiding errno.h constants, or the declaration
of fileno in <stdio.h>.

For hiding/revealing library header features, the implementors should use
feature selection macros (perhaps in conjunction with the dialect selection).

It is reasonable to want to use a standard C dialect, *and* have access to
some platform library features.

> If the later standards define more errno values, they should be only
> visible when the corresponding -std= option was specified for
> compiler.

If that is so, what -std= option should make E2BIG visible?
It's not in any historic or current C standrad.

A reasonable approach:

  *  In the absence of any dialect option or feature selection macro,
     the behavior can be GCC's default dialect, and everything is seen.
  *  -std=c99 or -ansi   hide E2BIG in errno.h, fileno in stdio.h, etc.
  *  -D_POSIX_SOURCE and other standard POSIX macros reveal what
     they are supposed to, regardless of dialect option.
  *  -D_DJGPP_SOURCE reveals everything in all headers

- Raw text -


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