| Deutsch English Français Italiano |
|
<85ldshjb72.fsf@nosuchdomain.example.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: "A diagram of C23 basic types"
Date: Thu, 03 Apr 2025 12:29:21 -0700
Organization: None to speak of
Lines: 58
Message-ID: <85ldshjb72.fsf@nosuchdomain.example.com>
References: <87y0wjaysg.fsf@gmail.com> <vsj1m8$1f8h2$1@dont-email.me>
<vsj2l9$1j0as$1@dont-email.me> <vsjef3$1u4nk$1@dont-email.me>
<vsjg6t$20pdb$1@dont-email.me> <vsjjd1$23ukt$1@dont-email.me>
<vsjkvb$25mtg$1@dont-email.me> <vsjlkq$230a5$2@dont-email.me>
<20250402232443.00003a7d@yahoo.com> <vslilm$8mfb$1@dont-email.me>
<vsm05b$k0b7$1@dont-email.me>
<85y0whjdw3.fsf@nosuchdomain.example.com>
<vsmlc4$1c39t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 03 Apr 2025 21:29:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="658736fab9029f452335cecd036b8387";
logging-data="1367561"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/GNbbgNHISvX826C5Swgk"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:8BDz+GK4CmoifYM/nEtqwtenaVo=
sha1:q1tIP427E9ZVdp3OL5epC7lamBw=
Bytes: 3810
David Brown <david.brown@hesbynett.no> writes:
> On 03/04/2025 20:31, Keith Thompson wrote:
>> bart <bc@freeuk.com> writes:
>> [...]
>>> I understand C23 mode will be enabled by a compiler option (-std=c23);
>>> the same method could have been used to enable all std headers, and
>>> for that to be the default.
>> The standard says exactly nothing about compiler options.
>> "-std=c23"
>> is a convention used by *some* compilers (gcc and other compilers
>> designed to be compatible with it).
>>
>>> Hello World then becomes this one-liner:
>>>
>>> int main() {puts("Hello, World!");}
>> A compiler could provide such an option as a non-conforming
>> extension
>> with no change in the standard. I'm not aware that any compiler
>> has done so, or that there's been any demand for it. One reason
>> for the lack of demand might be that any code that depends on it
>> is not portable. (Older versions of MS Visual Studio create a
>> "stdafx.h" header, but newer versions appear to have dropped that.)
>>
>
> gcc provides such an option :
>
> gcc -include stdio.h hello_world.c
>
> If someone really wanted to, they could easily make a shell script,
> bash alias, Windows bat file, or whatever, as a wrapper for gcc with a
> whole bunch of "-include" options for all the standard headers.
I wouldn't call that "such an option". The kind of option being
discussed is one that would implicitly include *all* the standard
headers.
Sure, you could use it in a wrapper script, but it would be just
as easy to write a wrapper script that generates and compiles a
source file that includes all the standard headers and the source
file and then compiles that (with a #line directive so diagnostic
messages refer to the original source file).
My point is that, as far as I'm aware, nobody has implemented
"implicitly include all the standard headers", either as a compiler
option or as a wrapper script. I'm sure somebody has (I could do
it in a few minutes), but it's just not something that programmers
appear to want.
Of course part of the motivation for *not* wanting this is that
it results in non-portable code, and if it were standardized that
wouldn't be an issue.
And if it were standardized, <assert.h> would raise some issues,
since NDEBUG needs to be defined or not defined before including it.
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */