extern and function prototypes

J

jacob navia

quarkLore said:
As this link points it out one can use extern instead of a function
prototype. Are they one and the same in terms of standard,
maintainability?

Has some one seen an advantage of one over the other?

When should one use simple prototype and when should one use an
extern?

http://www.eskimo.com/~scs/cclass/notes/sx5b.html

Re read. The link does not say that one can use extern
INSTEAD of a function prototype.
 
Q

quarkLore

Re read. The link does not say that one can use extern
INSTEAD of a function prototype.

Quoted verbatim from the link:
"You may want to stay in the habit of using extern
in all external declarations,
including function declarations, since ``extern
= external declaration'' is an easier rule to remember."

forget that and discuss the issue in hand
 
B

Ben Pfaff

quarkLore said:
When should one use simple prototype and when should one use an
extern?

A function prototype without any storage class specifier has the
same meaning as the otherwise similar function prototype with
storage class specifier "extern". Thus, you can choose to
include "extern" in the prototype, or not, at your whim. Most C
programmers do not use the "extern" keyword in their prototypes.
 
N

Nick Keighley

Quoted verbatim from the link:
"You may want to stay in the habit of using extern
in all external declarations,
including function declarations, since ``extern
= external declaration'' is an easier rule to remember."

forget that and discuss the issue in hand

forget what? What is the issue in hand?
extern cannot be used instead of a prototype.
 
P

pete

quarkLore said:
Quoted verbatim from the link:
"You may want to stay in the habit of using extern
in all external declarations, including function declarations,
since ``extern = external declaration''
is an easier rule to remember."

That's not what "external declaration" means.

An external declaration is a declaration
made outside of a function definition.

There's nothing else in a C program besides:
1 external declarations
2 preprocessor directives
3 comments
4 whitespace
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top