Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > stylistic prototype question

Reply
Thread Tools

stylistic prototype question

 
 
Mantorok Redgormor
Guest
Posts: n/a
 
      10-29-2003
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
 
Reply With Quote
 
 
 
 
Mark A. Odell
Guest
Posts: n/a
 
      10-29-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (Mantorok Redgormor) wrote in
news:(E-Mail Removed) om:

> 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();
}

--
- Mark ->
--
 
Reply With Quote
 
 
 
 
Mark A. Odell
Guest
Posts: n/a
 
      10-29-2003
"Mark A. Odell" <(E-Mail Removed)> wrote in
news:Xns9423B32A2D49ACopyrightMarkOdell@130.133.1. 4:

> static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum


Or was that Life Savers?

--
- Mark ->
--
 
Reply With Quote
 
Artie Gold
Guest
Posts: n/a
 
      10-29-2003
Mark A. Odell wrote:
> "Mark A. Odell" <(E-Mail Removed)> wrote in
> news:Xns9423B32A2D49ACopyrightMarkOdell@130.133.1. 4:
>
>
>>static int foo(void) <--- "Two mints in one" (tm) Wriggly Gum

>
>
> Or was that Life Savers?
>


Certs.

(Well, at least it *starts* with a `C'.)

<g,d&r>
--ag
--
Artie Gold -- Austin, Texas
Oh, for the good old days of regular old SPAM.

 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      10-29-2003
On 29 Oct 2003 22:36:45 GMT, in comp.lang.c , "Mark A. Odell"
<(E-Mail Removed)> wrote:

>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.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
Reply With Quote
 
Mark A. Odell
Guest
Posts: n/a
 
      10-30-2003
Mark McIntyre <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

>>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*.


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.

--
- Mark ->
--
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
stylistic question Bill Cunningham C Programming 16 11-12-2012 04:25 PM
Class prototype vs C function prototype June Lee C++ 2 04-13-2008 08:17 PM
A stylistic question. Mark Healey C Programming 60 05-28-2006 09:59 PM
Stylistic question about inheritance Andrew Koenig Python 17 04-01-2005 12:49 PM
Stylistic question -- initialization lists and vectors Denis Remezov C++ 4 04-30-2004 05:10 PM



Advertisments