Re: extern function declaration

Discussion in 'C++' started by Andrey Tarasevich, Jul 16, 2003.

  1. josef angermeier wrote:
    > extern is used to change the binding. i also understand that the keyword
    > extern prevents a expression like "extern int a" to be an definition, but
    > what use does it have to declare a function as extern though functions and
    > variables by default have external binding ?


    Specifying 'extern' in function declaration or definition is redundant,
    since, as you correctly noted yourself, functions have external linkage
    by default. However, sometimes I see 'extern' explicitly applied to
    functions in actual code. Must be someone's personal preference or,
    maybe, a workaround to a bug of some specific compiler.

    Specifiers as 'extern "C"' are a different story, but it looks like your
    question is about "regular" 'extern'.

    --
    Best regards,
    Andrey Tarasevich
    Brainbench C and C++ Programming MVP
    Andrey Tarasevich, Jul 16, 2003
    #1
    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. josef angermeier

    Re: extern function declaration

    josef angermeier, Jul 17, 2003, in forum: C++
    Replies:
    0
    Views:
    386
    josef angermeier
    Jul 17, 2003
  2. Jim Fischer

    Re: extern function declaration

    Jim Fischer, Jul 17, 2003, in forum: C++
    Replies:
    2
    Views:
    4,384
    josef angermeier
    Jul 18, 2003
  3. Thomas Matthews
    Replies:
    5
    Views:
    2,402
    tom_usenet
    Aug 2, 2004
  4. Andy
    Replies:
    2
    Views:
    1,599
    Matthew
    Jan 28, 2005
  5. Andre
    Replies:
    5
    Views:
    532
    Keith Thompson
    Jul 17, 2012
Loading...

Share This Page