Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C Moderated > Re: ANSI-C Data...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 1054 of 1134
Post > Topic >>

Re: ANSI-C Data Type "Prototyping" & Circular-Referenced Definitions ...

by =?ISO-8859-1?Q?Hans-Bernhard_Br=F6ker?= <HBBroeker@[EMAIL PROTECTED] > Mar 17, 2008 at 03:20 PM

ericshufro@[EMAIL PROTECTED]
 wrote:

> Similar to prototyping functions, 

Erm... we have a terminology mixup here.  What you're talking about is 
not prototyping, but "forward declaration".

> the reason we ask this question is to determine whether we can
> resolve circular definition situations that occur when ordering
> header files which have data type definitions each dependent on the
> other.

Even if you could, that would be rather obviously the wrong approach to 
the problem.  A much better approach, IMHO the only sensible one at all, 
is to not allow such mutual dependencies of headers, period.

> If SOME_STRUCT_NAME can be "prototyped" in a header PRIOR to
> 'header_a.h', then that structure name can be referenced in other
> header files PRIOR to its actual data type definition.

You're looking too hard at typedefs.  What you want to do is use the 
"struct struct_tag_name" way of referring to a struct.  And yes, you can 
forward-declare it:

	struct struct_tag_name;
-- 
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
 -- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line.  Sorry.
 




 5 Posts in Topic:
ANSI-C Data Type "Prototyping" & Circular-Referenced Definitions
ericshufro@[EMAIL PROTECT  2008-03-08 12:21:09 
Re: ANSI-C Data Type "Prototyping" & Circular-Referenced Definit
=?ISO-8859-1?Q?Hans-Bernh  2008-03-17 15:20:30 
Re: ANSI-C Data Type "Prototyping" & Circular-Referenced Definit
Jack Klein <jackklein@  2008-03-17 15:20:07 
Re: ANSI-C Data Type "Prototyping" & Circular-Referenced Definit
Jonathan Leffler <jlef  2008-03-17 15:20:43 
Re: ANSI-C Data Type "Prototyping" & Circular-Referenced Definit
Barry Schwarz <schwarz  2008-03-17 15:21:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:49:19 CDT 2008.