Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: absence of max Date: Thu, 01 Dec 2016 12:52:37 -0800 Organization: None to speak of Lines: 47 Message-ID: References: <0e1db67d-0ab8-4971-a319-8aa66a40b873@googlegroups.com> <436aadfe-20e5-4349-bdf4-9bac145b0d7e@googlegroups.com> <87oa0zi280.fsf@bsb.me.uk> <871sxvhw4i.fsf@bsb.me.uk> <87a8ch18kc.fsf@bsb.me.uk> <874m2o22jy.fsf@bsb.me.uk> <4894f89e-1b6a-4a7e-97b5-e12c9734da41@googlegroups.com> <8e947169-6c71-4977-b6fd-bb7a1185994b@googlegroups.com> <422c6643-4e2d-4b71-8937-434aad03bff9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="e9e90b81bc42428c034e25748a0d26e9"; logging-data="701"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187CXbAZkNc2/xdg6iegna4" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:jlKxBndiDA1COKkbqnqddUTlG/Q= sha1:1spik5cwrzWGJbO9N7GsGIEXiww= Xref: csiph.com comp.lang.c:97845 supercat@casperkitty.com writes: > On Thursday, December 1, 2016 at 12:52:34 PM UTC-6, Keith Thompson wrote: >> supercat writes: >> > A search of C99 "restrict" revealed an example of that syntax, and >> > a search of N1570 finds the same example, but I couldn't find >> > anyplace in either standard that actually described its meaning. >> > What am I missing? >> >> N1570 6.7.3p8 discusses it briefly. >> >> N1570 6.7.3.1 is the "Formal definition of restrict". >> >> Does your PDF viewer not have a search function? Sorry, that was inappropriately snarky. > I know what "int foo(int *restrict p)" means. I don't see anything, > however, that suggests that "int foo(int p[restrict])" would mean the > same thing. Given that the meaning of a "static" qualifier in an array > bound is totally different from its meaning in other contexts, and I > can't think of any cases where a qualifier within an array bound would > be applied to the array, I see nothing in the Standard which would > describe the meaning of the syntax using "[restrict]", beyond the fact > that its inclusion in an example suggests that it must be regarded as > valid and should probably mean something. N1570 6.7.6.3p7: A declaration of a parameter as "array of type" shall be adjusted to "qualified pointer to type", where the type qualifiers (if any) are those specified within the [ and ] of the array type derivation. If the keyword static also appears within the [ and ] of the array type derivation, then for each call to the function, the value of the corresponding actual argument shall provide access to the first element of an array with at least as many elements as specified by the size expression. "restrict" is a type qualifier, so a parameter declaration int p[restrict] is equivalent to int *retrict p -- 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"