473,805 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
+ 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 9584
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.rem comp.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.comwrit es:
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.comwrot e:
On Apr 20, 1:45 am, jacob navia <j...@jacob.rem comp.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.rem comp.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
2767
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++ source file I use: extern "C"{ // C function declarations } //C++ code
6
9582
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 i have also other functions defined in that file, i can use the global in all functions, but once i split up the rest of the function in other files, i cannot use the global? Isn't that strange, all the files compiled should be treated as one...
12
2730
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 linkage? Not much on this in the FAQ or tutorials.
29
448
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() { f(); }
16
2326
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 beginning to get out of hands if I continue to put in extra functionality in the (file-writing) output-functions....
7
2198
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
3539
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 (not the instructor) explained that if the same function prototype is used in more than one source file in a project, that the linker will complain.
5
2931
by: Medvedev | last post by:
What's that preprocessor do #ifdef __cplusplus extern "C" { #endif .. .. .. #ifdef __cplusplus } #endif
3
2032
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 small snapshot of it contains extern int a; void hello(int);
0
9716
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10360
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7646
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4323
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 we have to send another system
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.