Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Forward declarations |
| Date | 2015-11-16 11:05 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87bnaurypu.fsf@bsb.me.uk> (permalink) |
| References | (10 earlier) <3f4d20d4-503c-4fe2-8353-2f99a2620e63@googlegroups.com> <87twomsrc8.fsf@bsb.me.uk> <n2bbc2$1jm$1@dont-email.me> <87oaeuso40.fsf@bsb.me.uk> <n2be3c$8u0$1@dont-email.me> |
Eric Sosman <esosman@comcast-dot-net.invalid> writes: > On 11/15/2015 8:57 PM, Ben Bacarisse wrote: >> BartC <bc@freeuk.com> writes: >> >>> On 16/11/2015 00:47, Ben Bacarisse wrote: >>>> "Rick C. Hodgin" <rick.c.hodgin@gmail.com> writes: >>> >>>>> >>>>> I believe I am humble. But also, in this particular case, I happen >>>>> to be right. >>>> >>>> And yet you still haven't answered by question about which function is >>>> declared twice. The example included only two and you agreed that at >>>> least one much be declared twice so there are only two answers: foo or >>>> bar. I'd like to be charitable and assume that you are a bit confused >>>> about what constitutes the declaration of a function, but your not >>>> answering this question suggests otherwise. It suggests to me that you >>>> don't want to say because it would be so obviously false. >>>> >>>>> Every person could figure this out for themselves. >>>> >>>> That's the good part. I don't think many people reading this will come >>>> away thinking that the pointer parameter declaration is a second >>>> declaration for either "foo" or "bar". After all there were two >>>> functions and only two function declarations in the whole code example. >>> >>> Well I think this solution is unacceptable. >> >> That is your right. What you accept, in this unqualified sense, is up >> to you. Had you said "I don't accept that both functions are declared >> exactly once" you would have made a statement of fact (an incorrect >> one). >> >>> For foo() to call bas() later in the module, the compiler needs >>> certain information about how to call it. >>> >>> If a function pointer is used as here, then that would normally >>> provide most of that information. But in Tim's example, that is >>> incomplete, >> >> Deliberately so, I feel sure. >> >>> so some of that information has to be gleaned from the >>> nature of the call: the type and number of the arguments. These have >>> to be provided /before/ the definition of the bas. >>> >>> The only thing not known is the function address, so only an indirect >>> call can be made. A direct call would need a forward declaration >>> (unless you create some hairy self-modifying code). >> >> So you agree that there is no declaration of bar before the indirect >> function call. In fact, you agree that both foo and bar are declared >> exactly once. Would you point that out to Rick, please? He seems to >> take what you say as reliable and trustworthy. >> >>> The other unsatisfactory thing [...] >> >> I don't think anyone is claiming it's an example of a style to copy. > > Hmm: How many functions does > > void qsort(void*, size_t, size_t, > int(*)(const void*,const void*)); > > declare? > > (My answer: "One.") Mine too. Did you take my "not a style to copy" as suggesting that function pointers should not be used? I meant only that they should not be used simply to avoid a forward declaration. -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-10 14:20 -0800
Re: Forward declarations jacobnavia <jacob@jacob.remcomp.fr> - 2015-11-10 23:38 +0100
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-10 15:00 -0800
Re: Forward declarations Ian Collins <ian-news@hotmail.com> - 2015-11-11 12:24 +1300
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-10 15:53 -0800
Re: Forward declarations gazelle@shell.xmission.com (Kenny McCormack) - 2015-11-11 00:01 +0000
Re: Forward declarations Ian Collins <ian-news@hotmail.com> - 2015-11-11 13:46 +1300
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-10 21:05 -0800
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-11 00:21 +0000
Re: Forward declarations Lőrinczy Zsigmond <zsiga@nospam.for.me> - 2015-11-11 10:16 +0100
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-11 07:19 -0800
Re: Forward declarations David Brown <david.brown@hesbynett.no> - 2015-11-11 15:40 +0100
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-11 07:21 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-11 07:23 -0800
Re: Forward declarations David Brown <david.brown@hesbynett.no> - 2015-11-11 16:29 +0100
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-11 07:31 -0800
Re: Forward declarations Nick Bowler <nbowler@draconx.ca> - 2015-11-13 18:20 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-13 10:39 -0800
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-13 19:40 +0000
Re: Forward declarations Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-14 11:42 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 12:32 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 00:15 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 16:34 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 01:54 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 18:00 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 02:13 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 18:26 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 02:34 +0000
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-15 11:11 +0000
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 02:36 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 19:25 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 19:37 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-14 20:11 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 10:36 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 06:16 -0800
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-15 14:44 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 09:41 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 18:26 +0000
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-15 18:42 +0000
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 18:53 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 12:58 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 12:49 -0800
Re: Forward declarations Ian Collins <ian-news@hotmail.com> - 2015-11-16 10:01 +1300
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-15 14:54 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 09:53 -0800
Re: Forward declarations Keith Thompson <kst-u@mib.org> - 2015-11-15 10:36 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 12:56 -0800
Re: Forward declarations Ian Collins <ian-news@hotmail.com> - 2015-11-16 10:04 +1300
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 13:11 -0800
Re: Forward declarations Ian Collins <ian-news@hotmail.com> - 2015-11-16 10:25 +1300
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 13:37 -0800
Re: Forward declarations Tim Rentsch <txr@alumni.caltech.edu> - 2015-11-15 13:13 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 13:16 -0800
Re: Forward declarations David Brown <david.brown@hesbynett.no> - 2015-11-16 00:23 +0100
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 16:20 -0800
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-16 00:47 +0000
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-16 01:28 +0000
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-16 01:57 +0000
Re: Forward declarations Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-15 21:15 -0500
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-16 11:05 +0000
Re: Forward declarations Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-11-16 10:18 -0500
Re: Forward declarations Richard Heathfield <rjh@cpax.org.uk> - 2015-11-16 06:44 +0000
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-16 11:26 +0000
Re: Forward declarations David Brown <david.brown@hesbynett.no> - 2015-11-16 12:43 +0100
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-16 12:20 +0000
Re: Forward declarations David Brown <david.brown@hesbynett.no> - 2015-11-16 14:38 +0100
Re: Forward declarations Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-16 13:26 +0000
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-16 13:53 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-15 18:12 -0800
Re: Forward declarations pa@see.signature.invalid (Pierre Asselin) - 2015-11-12 01:54 +0000
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-12 02:08 -0800
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-12 09:58 +0000
Re: Forward declarations John Bode <jfbode1029@gmail.com> - 2015-11-17 14:46 -0800
Re: Forward declarations "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2015-11-17 14:59 -0800
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-17 23:35 +0000
Re: Forward declarations BartC <bc@freeuk.com> - 2015-11-17 23:40 +0000
Re: Forward declarations Keith Thompson <kst-u@mib.org> - 2015-11-17 19:48 -0800
Re: Forward declarations glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2015-11-18 01:04 +0000
csiph-web