473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

extern and function prototypes

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

Apr 19 '07 #1
5 9569
quarkLore wrote:
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.
Apr 19 '07 #2
On Apr 20, 1:45 am, jacob navia <j...@jacob.remcomp.frwrote:
quarkLore wrote:
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.
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

Apr 19 '07 #3
quarkLore <ag*************@gmail.comwrites:
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.
--
Comp-sci PhD expected before end of 2007
Seeking industrial or academic position *outside California* in 2008
Apr 19 '07 #4
On 19 Apr, 22:28, quarkLore <agarwal.prat...@gmail.comwrote:
On Apr 20, 1:45 am, jacob navia <j...@jacob.remcomp.frwrote:
quarkLore wrote:
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.

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.
--
Nick Keighley
Apr 20 '07 #5
quarkLore wrote:
>
On Apr 20, 1:45 am, jacob navia <j...@jacob.remcomp.frwrote:
quarkLore wrote:
>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.

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

--
pete
Apr 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: cpptutor2000 | last post by:
Could some C++ guru help me please? I am trying to build an application using gcc 3.2.3, that has a some classes using functions defined in some C files in the same directory. If inside the C++...
6
by: atv | last post by:
Alright, i have some questions concerning include files en global variables.I hope someone is willing to answer these. 1).Why is it that if i define a global variable in a file, say main.c, and...
12
by: G Patel | last post by:
I've seen some code with extern modifiers in front of variables declared inside blocks. Are these purely definitions (no definition) or are they definitions with static duration but external...
29
by: DevarajA | last post by:
Can anyone explain me what extern is used for? I thought it was used to declare variables definited in other files, but i can do that also without extern. /*file a.c*/ int a=5; int main() {...
16
by: Martin Jørgensen | last post by:
Hi, Problem: ======== Some of my output functions are beginning to take pretty many arguments... I mean.... We're talking about 10-15 arguments :-) So I thought to myself, perhaps this is...
7
by: Christian Christmann | last post by:
Hi, I've a a question on the specifier extern. Code example: void func( void ) { extern int e; //...
7
by: blangela | last post by:
I am currently taking a course and one of the example programs showed a function prototype something like: extern void func(); I asked why the "extern" was necessary. Someone in the class...
5
by: Medvedev | last post by:
What's that preprocessor do #ifdef __cplusplus extern "C" { #endif .. .. .. #ifdef __cplusplus } #endif
3
by: polas | last post by:
I have a quick question - I have used extern quite a bit in relation to variables, however was wondering if its applicable to function prototypes too? For instance, I have a file called a.c - a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.