473,472 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 9571
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.