TIP: Click on subject to list as thread! ANSI
echo: locuser
to: Paul Edwards
from: Keith Richardson
date: 1995-06-21 13:46:36
subject: C

On (20 Jun 95) Paul Edwards wrote to Keith Richardson...



 KR> i have a book put out by tartan laboratories at carnegie melion

 KR> university in 1984 ie 6 years after k & r, but before ansi, and that

 KR> makes no mention at all of prototypes only declaratives.



 PE> I have found a K&R 1st edition book at work, and I quote from

 PE> chapter 4.2...



 PE> The declaration



 PE>     double sum, atof();



 PE> says that sum is a double variable, and that atof is a function

 PE> that returns a double value.    





 PE> They're using the terminology "declaration" instead of
"prototype".

 PE> Either way, it is declarations/prototypes that allowed C to be

 PE> single pass.  BFN.  Paul.



that a little different to this book, the only declarators that they

mention are those at the head of the function definition, extern, and

static. the extern and static cases do not include a list of parameter

types.



i dont know the status of this book to the mainstream of c usage at the

time, i dont even remember, where i got it. i think that it may have

been some sale, and i've hardly ever referred to it.



the borland c++ v4.5 programmer's guide says the following:-



[quote]



Declarations and prototypes



In the Kernighan and Ritchie style of declaration, a function could be

implicitly declared by its appearance in a function call, or explicitly

declared as follows:



 func() 



where type is the optional return type defaulting to int. In C++, this

declaration means  func(void). A function can be declared to

return any type except an array or function type. This approach does

not allow the compiler to check that the type or number of arguments

used in a function call match the declaration.



This problem was eased by the introduction of function prototypes with

the following declaration syntax:



 func(parameter-declarator-list);



[end quote]



that is my understanding of function prototypes, they are there to

enable the compiler to pick up mismatches between the formal and actual

argument lists, not to enable single pass compilation.



                        Keith



... "C++ is too complicated already" - Bjarne Stroustrup



--- PPoint 1.88


* Origin: Malfunction Junction (3:711/934.6)
SEEN-BY: 711/934
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.