Joe Wright wrote:
> pete wrote:
>>
.... snip ...
>>
>> Definitions are also declarations, which is why CBFalconer
>> likes to put the definitions of other functions, above main.
>
> Like CBFalconer, I do that too, all the time. Nowhere do I say
> that a definition is not a declaration.
Which has a multitude of advantages. I never make a mistake in
matching the function header to its prototype, and it caters to
extreme laziness in that I never type something twice, or even have
to cut and paste a header. Whenever I am looking for the
definition of a function I know precisely in which direction in the
source to look.
I also like to have a clear demarcation between the code for one
function and the header of the next. Marking the trailing '}' with
a comment indicating which function it ends is also handy when
rummaging about in the source. Thus:
} /* foo */
/* --------------- */
/* Do foo(lish) things in a bar */
static int bar(...)
{
--
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare