linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* weird structure definition in header file
@ 2005-09-06 19:13 Robert P. J. Day
  2005-09-06 19:23 ` nhorman
  2005-09-06 20:24 ` Ronaldo.Afonso
  0 siblings, 2 replies; 9+ messages in thread
From: Robert P. J. Day @ 2005-09-06 19:13 UTC (permalink / raw)
  To: C programming list


  i'm looking at some legacy code and, in a header file, i find the
following (paraphrased for brevity):

typedef struct {
	... stuff ...
} Widgets ;

extern Widgets Widget ;


  huh?  i can see why a header file would want to define a structure
but i'm confused why the *header* file would then refer to an external
object of that type.  that's a new one on me -- typically, i'd expect
a *source* file to define such a thing and other *source* files to
contain the "extern" declaration.

  is this some subtle programming cleverness of which i am unaware?
thanks.

rday

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-09-07  1:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-06 19:13 weird structure definition in header file Robert P. J. Day
2005-09-06 19:23 ` nhorman
2005-09-06 19:27   ` Robert P. J. Day
2005-09-06 19:45     ` Robert P. J. Day
2005-09-06 19:56       ` nhorman
2005-09-07  1:20       ` Glynn Clements
2005-09-07  1:17     ` Glynn Clements
2005-09-06 19:57   ` Steve Graegert
2005-09-06 20:24 ` Ronaldo.Afonso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).