Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!news1.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Thu, 30 Jun 2011 16:37:55 -0500 |
| Message-ID | <4E0CECB1.3D9D@mindspring.com> (permalink) |
| Date | Thu, 30 Jun 2011 17:37:53 -0400 |
| From | pete <pfiland@mindspring.com> |
| Reply-To | pfiland@mindspring.com |
| Organization | PF |
| X-Mailer | Mozilla 3.04Gold (WinNT; I) |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.c |
| Subject | Re: Use of EXTERN |
| References | <iuimrb$9c$1@speranza.aioe.org> |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| Lines | 61 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 4.154.217.3 |
| X-Trace | sv3-BAHjumGdOq0zw1FR/SYZ4I2AhOF3W1LZ6YVbPDuqC/5LiM6c0PIjpTr/XKne0UNhz+vglTwrfohPcwL!A5XL8jxfFwBvuADg5r07SoaXLCbvZPPZjardBXHyMWGRH1ap1ut1UadLruwLCyNR71oTMX3WlgHQ!oDpa2ZlZ |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2898 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.c:7327 |
Show key headers only | View raw
Tom Young wrote: > > Hi all. I've read through all the > K&R2 chapters and I'm now reading the appendices. > Specifically, I'm reading section A11 - Scope & Linkage p227. > I have a question about the "extern" property. > > Section A11.2 Linkage p228 says: > > "All declarations for the same object or function identifier > with external linkage refer to the same thing, > and the object or function is shared by > the entire program." > > and > > "... the first external declaration for an identifier > gives the identifier > internal linkage if the static specifier is used, > external linkage otherwise." > > My questions are, > is there any point to declaration an external object "extern"? > Does it have any effect(s)? > I'm almost positive I've seen code > with external declarations that included the keyword "extern", > but given > the quoted statements above, that seems redundant. Am I missing > something? I have a program called "e_driver". It consists of six files: http://www.mindspring.com/~pfilandr/C/e_driver/e_driver.c http://www.mindspring.com/~pfilandr/C/e_driver/e_driver.h http://www.mindspring.com/~pfilandr/C/e_driver/e_sort.c http://www.mindspring.com/~pfilandr/C/e_driver/e_sort.h http://www.mindspring.com/~pfilandr/C/e_driver/e_distributions.c http://www.mindspring.com/~pfilandr/C/e_driver/e_distributions.h e_driver.c has this external declaration: long unsigned cmp_count; e_driver.h has this external declaration: extern long unsigned cmp_count; e_driver.c and e_sort.h and e_distributions.h all have this line: #include "e_driver.h" e_sort.c has this line: #include "e_sort.h and e_distributions.c has this line: #include "e_distributions.h" All three of the *.c files in the e_driver program use the same external object (cmp_count), which is declared in e_driver.c -- pete
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Use of EXTERN Tom Young <tyoung37@gmail.invalid> - 2011-06-30 20:38 +0000 Re: Use of EXTERN pete <pfiland@mindspring.com> - 2011-06-30 17:37 -0400 Re: Use of EXTERN James Kuyper <jameskuyper@verizon.net> - 2011-07-01 07:11 -0400
csiph-web