Path: csiph.com!1.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!gandalf.srv.welterde.de!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: Fri, 04 Aug 2023 20:15:45 -0700 Organization: A noiseless patient Spider Lines: 50 Message-ID: <86sf8yface.fsf@linuxsc.com> References: <20230524162836.172@kylheku.com> <86cz0mzemm.fsf@linuxsc.com> <9x2cnQDaqOkRtyf5nZ2dnZeNn_di4p2d@giganews.com> <20230721215906.639@kylheku.com> <86lef4rwx9.fsf@linuxsc.com> <20230725120541.589@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: dont-email.me; posting-host="943f511331d2b471aa1b6ebff38979e9"; logging-data="1709797"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mG2CrPMlyh6jkmuR8DpRNS9TVSuS9Y8Y=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:AvnI/wYf7I3mL7UnpqtZwCKz7HQ= sha1:SpY66//jfL0HkcEtrgdi9DFEwNI= Xref: csiph.com comp.std.c:6527 Kaz Kylheku <864-117-4973@kylheku.com> writes: > On 2023-07-25, Tim Rentsch wrote: > >> 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. [...] > Here is a realistic plan. > > Phase 1: > > [...] > > Phase 2: > > [...] > > Phase 3: > > [...] Here is a simpler and better idea. Add a Recommended Practice that compilers provide an option to produce a diagnostic when a function parameter is restrict-qualified in the function definition but is not restrict-qualified in any other declaration of the function in the same compilation unit. And nothing more than that.