Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Using fread function Date: Thu, 09 Feb 2017 09:19:26 -0800 Organization: None to speak of Lines: 53 Message-ID: References: <02c75a0c-84d7-4669-8bde-472730c7f8d3@googlegroups.com> <79af9f0c-d7e1-ef68-d186-f1ce0baa9e6c@verizon.net> <05a6afe0-d7db-4877-a244-1c5c7bc8e928@googlegroups.com> <28dc26c8-8063-4334-9850-b1a5ba7876f3@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="ecbc845b6da81c9d4b7b978122232250"; logging-data="4496"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18J6QRCDCjub/25hhjRxF+O" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:+4/7VHljG9FoDNyEv4+CWscNTxE= sha1:+R+zjZduPbZw8aIuzwkMw9jWAsQ= Xref: csiph.com comp.lang.c:103538 supercat@casperkitty.com writes: > On Thursday, February 9, 2017 at 7:40:00 AM UTC-6, james...@verizon.net wrote: >> It's rather peculiar that, like function parameter names, qualifiers >> on parameters in a non-defining prototype are permitted but >> meaningless. I believe that they were permitted, so that the same >> prototype could be used for the declaration and the >> definition. However, because they are meaningless, it's not mandatory >> for the declaration and the definition to have prototypes that match >> in those ways. It could have been mandatory; the standard goes out of >> it's way to make it not mandatory, so that was clearly deliberate. > > I also find it peculiar that the Standard doesn't require that > implementations do anything useful with qualifiers like "restrict" and > "register" but requires that even implementations where they serve no > purpose must still go through the effort of validating them. In cases > where many or all implementations' natural behavior in the absence of a > qualifier would match the required behavior with the qualifier, but > either: > > (1) the qualifier could allow implementations to generate more efficient > code, or > > (2) the qualifier could make the code usable on platforms that were > capable of supporting the behavior at some cost but didn't do so by > default > > allowing implementations that naturally support the required behavior to > "support" the qualifier by simply it would minimize the burden the qualifier > would place upon implementations. I think you accidentally a word. Did you mean "by simply *ignoring* it"? If so, what exactly do you mean by that? Are you suggesting that an implementation that doesn't do anything useful with "restrict" should be able to ignore it altogether, so that int n = restrict 42; would be quietly treated as a valid declaration? Or that an implementation that ignores register should allow the address of a register-qualified object to be taken? If so, why? If I write code that uses "register" or "restrict", I want my compiler to check my code for validity, whether they have any semantic impact or not. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"