stylistic prototype question

M

Mantorok Redgormor

What do some of you guys prefer?

static int foo(void);

int main(void)
{
return foo();
}

static int foo(void)
{
return 0;
}


or..

static int foo(void);

int main(void)
{
return foo();
}

int foo(void)
{
return 0;
}

I have been told that if I write code like the latter I'll have my fingers broken
 
M

Mark A. Odell

(e-mail address removed) (Mantorok Redgormor) wrote in

What do some of you guys prefer?

static int foo(void);

int main(void)
{
return foo();
}

static int foo(void)
{
return 0;
}


or..

static int foo(void);

static here...


int main(void)
{
return foo();
}

int foo(void)

But not here, just plain confusing.
{
return 0;
}

I have been told that if I write code like the latter I'll have my
fingers broken

Yes, you will. Why not let the definition be the prototype?

static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum
{
return 0;
}

int main(void)
{
return foo();
}
 
M

Mark McIntyre

Yes, you will. Why not let the definition be the prototype?
static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum

Yeah, but this means writing your code *backwards*.

In the Good Old Days we had to do that, but now we're all growed up
and are awwowed to use pwototypes all by arselves. So the code can we
in any order put, hmm? Good, this is.

Back to the the main point - your prototype should match your
definition. So broken fingers might well be meted out for the original
posting.
 
M

Mark A. Odell

Yeah, but this means writing your code *backwards*.

So putting the pieces in front of the "thing" that will use them is
backwards is it? Interesting point of view.
In the Good Old Days we had to do that, but now we're all growed up
and are awwowed to use pwototypes all by arselves. So the code can we
in any order put, hmm? Good, this is.

So in the good new days, it's better to keep two things synchronized?
Besides I did use a prototype - a definition is also a prototype.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top