stylistic prototype question

Discussion in 'C Programming' started by Mantorok Redgormor, Oct 29, 2003.

  1. 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
     
    Mantorok Redgormor, Oct 29, 2003
    #1
    1. Advertising

  2. (Mantorok Redgormor) wrote in
    news::

    > 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 ->
    --
     
    Mark A. Odell, Oct 29, 2003
    #2
    1. Advertising

  3. "Mark A. Odell" <> 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 ->
    --
     
    Mark A. Odell, Oct 29, 2003
    #3
  4. Mantorok Redgormor

    Artie Gold Guest

    [OT] Re: stylistic prototype question

    Mark A. Odell wrote:
    > "Mark A. Odell" <> 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.
     
    Artie Gold, Oct 29, 2003
    #4
  5. On 29 Oct 2003 22:36:45 GMT, in comp.lang.c , "Mark A. Odell"
    <> 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 =---
     
    Mark McIntyre, Oct 29, 2003
    #5
  6. Mark McIntyre <> wrote in
    news::

    >>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 ->
    --
     
    Mark A. Odell, Oct 30, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. P.Hill
    Replies:
    13
    Views:
    561
    Adam Maass
    Apr 23, 2004
  2. Denis Remezov
    Replies:
    4
    Views:
    477
    Siemel Naran
    Apr 30, 2004
  3. Andrew Koenig

    Stylistic question about inheritance

    Andrew Koenig, Mar 31, 2005, in forum: Python
    Replies:
    17
    Views:
    495
    Guy Bolton King
    Apr 1, 2005
  4. Mark Healey

    A stylistic question.

    Mark Healey, May 14, 2006, in forum: C Programming
    Replies:
    60
    Views:
    1,245
    Jordan Abel
    May 28, 2006
  5. Bill Cunningham

    stylistic question

    Bill Cunningham, Nov 10, 2012, in forum: C Programming
    Replies:
    16
    Views:
    391
    Stephen Sprunk
    Nov 12, 2012
Loading...

Share This Page