Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Forward declarations |
| Date | 2015-11-16 10:25 +1300 |
| Message-ID | <dasbi3Fi0ttU17@mid.individual.net> (permalink) |
| References | (11 earlier) <87io53tis5.fsf@bsb.me.uk> <lnk2pjm7na.fsf@kst-u.example.com> <45becf4f-4a4c-487b-bf9d-e160b96608cd@googlegroups.com> <dasab5Fi0ttU16@mid.individual.net> <1f5a9fe1-f88d-47b6-b178-0c95d422752f@googlegroups.com> |
Rick C. Hodgin wrote: > On Sunday, November 15, 2015 at 4:04:46 PM UTC-5, Ian Collins wrote: >> Rick C. Hodgin wrote: >>> >>> I am referring to this part specifically: >>> >>> int foo(char *s, int n, int ferrah(char* s, int n)) >>> ^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> Here we see: >>> >>> int ferrah(char* s, int n) >>> >>> Except for that fact that it doesn't have a trailing semicolon, it >>> is a function declaration. It defines the return type, the name, >>> the parameters, and it is available for use within the function, >>> albeit as a function pointer, but that is an internal issue and >>> not an external one. >> >> No, it'd a function pointer. Would you say the same id the code were >> written: >> >> typedef int (*Fn)(char*, int); >> >> int foo(char *s, int n, Fn ferrah ) >> >> ? > > No. In this case the function definition is given on the typedef line. There isn't a function definition. The typedef creates an alias to a function pointer type. > In the case of Tim's example, expanded in my example above with the full > parameter listing, that is the function declaration. No it isn't, it is just a function pointer parameter. A function pointer is a type, just like int* is a type. > Concept-wise, there is a new function being declared. It is accessible > through the named parameter variable, but its existence, its form, its > signature, everything about it is declared there in the function parameter > declaration. Only it isn't. > It's a very simple concept. I'm at a loss how you make the distinction > to say that a function pointer is being declared because, while that is > true, the function pointer points to something ... and what does it point > to? That's right! A function declaration, which conveys the target then > of the independent component, which is the address conveyed through the > pointer. A function pointer (just like any other pointer type) doesn't have to point to anything. It is type. A function pointer can point to any function with the correct signature, so how can it specify a *specific* function declaration? It can't, any more than an int pointer declares a *specific* int. > I don't know how much experience you have on x86 OS programming, Ian, or > Ben, but on the x86 there is something called a segment selector. In my case, decades.... -- Ian Collins
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