Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: extern function declaration

Thread Tools

Re: extern function declaration

Andrey Tarasevich
Posts: n/a
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

Reply With Quote

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
Difference of extern short *x and extern short x[]? Andre C Programming 5 07-17-2012 07:38 PM
Function declaration in class declaration Ovidesvideo C++ 4 12-10-2004 06:36 PM
extern const char * vs. extern const char [] Thomas Matthews C++ 5 08-02-2004 10:36 AM
Re: extern function declaration Jim Fischer C++ 2 07-18-2003 02:28 AM
Re: extern function declaration josef angermeier C++ 0 07-17-2003 08:31 AM