One extern usage

Discussion in 'C Programming' started by newsock, Oct 22, 2003.

  1. newsock

    newsock Guest

    What's the implied meaning of using extern below?

    extern int main(void)
    {
    ...
    }
     
    newsock, Oct 22, 2003
    #1
    1. Advertising

  2. newsock wrote:

    > What's the implied meaning of using extern below?
    >
    > extern int main(void)
    > {
    > ...
    > }


    It's identical to:

    int main(void)
    {
    ...
    }

    and I presume you already know what that means.

    --
    Richard Heathfield :
    "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
    C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
    K&R answers, C books, etc: http://users.powernet.co.uk/eton
     
    Richard Heathfield, Oct 22, 2003
    #2
    1. Advertising

  3. newsock

    Rick Guest

    Doesn't extern imply that the function or variable or whatever that's
    being extern'd is externally defined some place? Does writing extern
    like this have any possible side effects? What if it was written against
    some variable?

    Richard Heathfield wrote:
    > It's identical to:
    >
    > int main(void)
    > {
    > ...
    > }
    >
    > and I presume you already know what that means.
    >



    Thanks

    Rick
     
    Rick, Oct 22, 2003
    #3
  4. newsock

    Dan Pop Guest

    In <3f96460a$> Rick <rrquick@nospam-com> writes:

    >Doesn't extern imply that the function or variable or whatever that's
    >being extern'd is externally defined some place? Does writing extern
    >like this have any possible side effects? What if it was written against
    >some variable?


    On function declarations/definitions, extern is the default and
    explicitly mentioning it makes no differences.

    On object declarations, extern prevents the declaration from becoming
    a tentative definition.

    Dan
    --
    Dan Pop
    DESY Zeuthen, RZ group
    Email:
     
    Dan Pop, Oct 22, 2003
    #4
    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. metfan
    Replies:
    2
    Views:
    4,865
    Robert Olofsson
    Oct 21, 2003
  2. Thomas Matthews
    Replies:
    5
    Views:
    2,485
    tom_usenet
    Aug 2, 2004
  3. sks
    Replies:
    3
    Views:
    416
  4. Medvedev

    extern "c" usage?!!

    Medvedev, Jul 6, 2008, in forum: C++
    Replies:
    3
    Views:
    455
    James Kanze
    Jul 7, 2008
  5. Andre
    Replies:
    5
    Views:
    550
    Keith Thompson
    Jul 17, 2012
Loading...

Share This Page