D
Dan Pop
In said:Just a question - were parentheses EVER required on a 'return'
statement in C?
http://www.lysator.liu.se/c/bwk-tutor.html
What if we wanted count to return a value, say the number of
characters read? The return statement allows for this too:
int i, c, nchar;
nchar = 0;
...
while( (c=getchar( )) != '\0' ) {
if( c > size || c < 0 )
c = size;
buf[c]++;
nchar++;
}
return(nchar);
Any expression can appear within the parentheses.
This is a strong implication that, by the time this tutorial was written,
4 years before K&R1, returning a value *required* the parentheses.
Even K&R1 consistently uses them when returning values, although the
syntax specification in Appendix A doesn't require them. It must have
been a very recent change to the language syntax.
Dan