"Christopher Benson-Manica" <at***@nospam.cyberspace.org> wrote in message
news:bm**********@chessie.cirr.com...
Dan Pop <Da*****@cern.ch> spoke thus:
Please elaborate.
Basically, I want to know how Dennis Ritchie and the Standards Committee can
arrive at diametrically opposed positions regarding empty parentheses. Why
does Dennis believe the syntax should be retained? Presumably it isn't
because he's a crackpot, because various important people (like Bjarne
Stroustrup) agree with his reasoning.
I believe the issue has been slightly misstated. The original C language
that Ritchie developed had no mechanism for making the argument types a
part of the function type. The C committee added what we call function
prototypes to remedy what was widely perceived as a clear deficiency.
(We modeled those prototypes largely on previous C++ work, but not entirely.
For example, I had developed a commercial C compiler as early as 1975 that
had something similar.)
The quandary we then faced was what to do about backward compatibility.
Ritchie stated a strong dislike for having two mechanisms that did much
the same thing, only differently. The committee was sympathetic with that
view, but had a practical problem to solve. So we left the 'T f()' notation
to declare f as a function returning T with no constraints on argument
types. We also added 'T f(void)' as a way of clearly stating that f was
constrained to have no arguments, and the ... notation for a varying length
argument list with no type constraints. The rules for mixing old and new
style declarations and definitions we worked out to minimize surprises.
(A major contribution was Sam Harbison's rule about implicit prototypes,
which we quickly dubbed the Miranda Rule.)
None of us liked having two similar but different rules for declaration.
Many of us regretted parting company with C++ on the meaning of 'T f()'.
Ritchie was gracious enough to acknowledge that what we did was probably
necessary, however undesirable. I haven't heard the term 'abomination'
applied to this situation (except possibly by C++ zealots) for nearly
20 years now.
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com