Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ike Naar <ike@iceland.freeshell.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: struct inside struct |
| Date | 2011-07-24 10:27 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <slrn3vfsj2nst3.krd.ike@iceland.freeshell.org> (permalink) |
| References | <4e2a94c5$0$313$14726298@news.sunsite.dk> <cb4393dd-5f67-4720-b385-aebcb5a6c75b@o4g2000vbv.googlegroups.com> |
On 2011-07-23, Kleuskes & Moos <kleuske@xs4all.nl> wrote: > On Jul 23, 11:30?am, arnuld <sunr...@invalid.address> wrote: >> void print_parent_struct(struct parent s); >> void print_parent_struct_p(struct parent* ps); > > Put the implementation here and loose the forward declarations. They > aren't really neccessary and thus introduce a dependency for no good > reason. In small programs such as this, it's trivial, but if your > programs become larger, this does become a point. The dependency is already there: it's the fact that a caller calls a callee. If one tries to avoid forward declacations, the consequence is that the definition of callee must precede the definition of caller. If the program evolves and new "caller calls callee" dependencies arise, it may be necessary to rearrange the function definitions. If one uses forward declarations, the order of definition of caller and callee is not restricted, but of course there is now duplication of the function headers. Looks like here's an example of the law of preservation of misery.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
struct inside struct arnuld <sunrise@invalid.address> - 2011-07-23 09:30 +0000
Re: struct inside struct "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-23 04:32 -0700
Re: struct inside struct Fonz <fonz@bogus.from.address.nl> - 2011-07-23 12:02 +0000
Re: struct inside struct pete <pfiland@mindspring.com> - 2011-07-23 20:05 -0400
Re: struct inside struct "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-24 01:20 -0700
Re: struct inside struct Ike Naar <ike@iceland.freeshell.org> - 2011-07-24 10:27 +0000
Re: struct inside struct "Kleuskes & Moos" <kleuske@xs4all.nl> - 2011-07-24 03:34 -0700
csiph-web