Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.std.c
Subject: Re: What is the point of restrict in fopen?
Date: Tue, 25 Jul 2023 05:35:30 -0700
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <86lef4rwx9.fsf@linuxsc.com>
References: <20230524162836.172@kylheku.com> <86cz0mzemm.fsf@linuxsc.com> <9x2cnQDaqOkRtyf5nZ2dnZeNn_di4p2d@giganews.com> <20230721215906.639@kylheku.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="25cc9caf93cbb682b63b59729477b86a"; logging-data="1184604"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7PUpRai3Dd+ziWtAc87ofcDy8irKDRqk="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:VdkiY+SjQ1lYfs07v7u6vTcGNVQ= sha1:qSF2I3F8Wmr4O8A+8gC+IVqUUpM=
Xref: csiph.com comp.std.c:6517
Kaz Kylheku <864-117-4973@kylheku.com> writes:
> On 2023-07-21, Jakob Bohm wrote:
>
>> On 2023-07-20 19:17, Tim Rentsch wrote:
>>
>>> Kaz Kylheku <864-117-4973@kylheku.com> writes:
>>>
>>>> I've noticed that both arguments of fopen are restrict-qualified.
>>>
>>> What I think you mean is that the arguments given in the prototype
>>> declaration in the C standard are qualified with the 'restrict'
>>> keyword.
>>>
>>> Note that this form of declaration has no effect on the semantics
>>> of the function. The function declaration, and its semantics, are
>>> just the same as if the uses of 'restrict' were removed.
>>
>> Note that Tim's critique or restrict in May 2023 is very similar
>> to the critique of the similar noalias proposal in messageid
>> <7753@alice.UUCP> by someone highly respected in this group.
>> That was posted 35 years ago.
>
> That someone was even opposed to const, for some good reasons.
>
> The present issue reveals a design flaw in the C type system:
> that qualifiers on function parameters don't matter.
>
> They should, though.
>
> void f(const int);
> void f(int);
>
> should be incomaptible and diagnosed!
A foolish consistency is the hobgoblin of little minds.