Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 May 2001 05:39:02 +0200
From:      Roelof Osinga <roelof@nisser.com>
To:        Greg Lehey <grog@lemis.com>
Cc:        Garance A Drosihn <drosih@rpi.edu>, j mckitrick <jcm@FreeBSD-uk.eu.org>, freebsd-questions@FreeBSD.ORG
Subject:   Re: return(value) or return value? (was: style(9) question)
Message-ID:  <3B01F656.8FF2B626@nisser.com>
References:  <20010515184940.A56109@dogma.freebsd-uk.eu.org> <p05100e0bb727313f1395@[128.113.24.47]> <20010516112824.B35292@wantadilla.lemis.com> <3B01EE40.4D2D6534@nisser.com> <20010516124259.B83152@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Greg Lehey wrote:
> 
> >>> Apparently, some very early versions of C required this.
> >>
> >> Specifically, versions before about 1973.

> > Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language
> > 1978 (!) published by Prentice Hall Software Series.
> 
> I don't know what you're trying to say here.  By the time this book
> was written, the parentheses were no longer required.

I would've though that to be self evident. That the creators of the
language said in their book published in 1978 - thus five years later
then the date you mentioned - to use the () expression in return.

> This appears to be an error.  In Appendix A, which is definitive, on
> page 203, it states:

Appendix A I quoted in the later parts of my message.

>   return ;
>   return expression ;

Let's skip the analysation of this, you're right in the end and I know it.

> I asked Dennis Ritchie about this some time back.  Here's the reply:
> 
...
> > An archaism: just so.  The language and compiler ca. 1973
> > did want the parens.  By the 5th edition (1975) I had realized that
> > they weren't needed and the syntax was just 'return expression'.

To bad they failed to mention that in they're 1978 book.

> >
> > On the other hand, no one seemed to want to make use of the
> > new freedom.  I glanced at v7 source (1977) and couldn't
> > find any instances of non-parenthesized return values--
> > I might have missed an instance, but there couldn't have
> > been more than a very few. Evidently it had become wired
> > into the mental syntax.
> >
> > This was certainly true for Brian in K&R 1 and evidently
> > for me as well, since the very few examples in the appendix
> > use the ().  But the grammar does indeed reflect the
> > fact that they weren't required.

Like I said, my later quotations in my message were from that
very same appendix. Furthermore I wasn't taking it all to
seriously as indicated by my saying that they - Dennis, it seems 
to've been - did a good job in turning up the obfuscation level.

IOW I tuned out. I saw your message stating '73, so I thought, Ok
let's check. Grabbed K&R 1.0, noticed it was published in '78
yet still mentioned using "return ();".

So I missed in the quick of it some fine points of syntax. Like
Denis put it, "What's in a name?". To which I would like to add
"That an expression in any other semantics would compute as sweet!".

Roelof

PS do note that I was not actually disagreeing with you, barring on
the point of the date supported by K&R 1.0. Do also note Dennis'
few examples versus grammer. Nonetheless, you were indeed - and as
usual - right and I was proofed - as usual ;) - wrong.

-- 
_______________________________________________________________________
eBOAź                                               est. 1982
http://eBOA.com/                                    tel. +31-58-2123014
mailto:info@eBOA.com?subject=Information_request    fax. +31-58-2160293

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B01F656.8FF2B626>