Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | James Kuyper <jameskuyper@verizon.net> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Casting function pointers to different signatures |
| Date | 2015-04-23 19:22 -0400 |
| Organization | Self |
| Message-ID | <55397EAE.1040009@verizon.net> (permalink) |
| References | <9938e88b-965b-4d07-8e86-62b3afa07849@googlegroups.com> <55395FD4.90707@verizon.net> <ed979da3-069e-4ccb-a99d-951a7fa34ae2@googlegroups.com> <55396C7E.3070403@verizon.net> <6ac6f8b2-cf77-4112-94ac-f5f0d8d82060@googlegroups.com> |
On 04/23/2015 06:49 PM, samuelallenalexander@gmail.com wrote: > On Thursday, April 23, 2015 at 11:04:53 PM UTC+1, James Kuyper wrote: >> On 04/23/2015 05:39 PM, Sam wrote: ... >>> Thanks for the very detailed answer with references and everything. >>> >>> It's really too bad the behavior is undefined since it would open the door for porting some genuinely useful OOP/FP idioms into C. >> >> How is the door closed? It's trivial to make the function types >> compatible, and if you do, the code will work. Could you give an example >> of code using one of those idioms where it's excessively difficult to >> avoid the problem? Your current example does NOT qualify. > > Yes, you could make the individual printer functions have signature > void (*) (void*), but that makes those individual printer functions a > lot more opaque on their own, and it's very repetitive that you have > to repeat the casts over and over. That comment suggests a possible misunderstanding. If the function types were, in fact, compatible, there would be no need for a cast, the function would already have the correct type.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Casting function pointers to different signatures samuelallenalexander@gmail.com - 2015-04-23 13:39 -0700
Re: Casting function pointers to different signatures Barry Schwarz <schwarzb@dqel.com> - 2015-04-23 14:01 -0700
Re: Casting function pointers to different signatures James Kuyper <jameskuyper@verizon.net> - 2015-04-23 17:10 -0400
Re: Casting function pointers to different signatures samuelallenalexander@gmail.com - 2015-04-23 14:39 -0700
Re: Casting function pointers to different signatures James Kuyper <jameskuyper@verizon.net> - 2015-04-23 18:04 -0400
Re: Casting function pointers to different signatures samuelallenalexander@gmail.com - 2015-04-23 15:49 -0700
Re: Casting function pointers to different signatures James Kuyper <jameskuyper@verizon.net> - 2015-04-23 19:22 -0400
Re: Casting function pointers to different signatures samuelallenalexander@gmail.com - 2015-04-24 10:42 -0700
Re: Casting function pointers to different signatures James Kuyper <jameskuyper@verizon.net> - 2015-04-24 14:18 -0400
Re: Casting function pointers to different signatures samuelallenalexander@gmail.com - 2015-04-24 12:36 -0700
Re: Casting function pointers to different signatures James Kuyper <jameskuyper@verizon.net> - 2015-04-24 15:50 -0400
Re: Casting function pointers to different signatures Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-24 13:18 -0700
Re: Casting function pointers to different signatures Siri Cruz <chine.bleu@yahoo.com> - 2015-04-23 16:08 -0700
Re: Casting function pointers to different signatures Keith Thompson <kst-u@mib.org> - 2015-04-23 18:36 -0700
Re: Casting function pointers to different signatures Siri Cruz <chine.bleu@yahoo.com> - 2015-04-23 19:00 -0700
Re: Casting function pointers to different signatures raltbos@xs4all.nl (Richard Bos) - 2015-04-25 10:48 +0000
Re: Casting function pointers to different signatures Tim Rentsch <txr@alumni.caltech.edu> - 2015-04-25 04:05 -0700
Re: Casting function pointers to different signatures Lőrinczy Zsigmond <nospam@for.me> - 2015-04-24 06:51 +0200
Re: Casting function pointers to different signatures Richard Damon <Richard@Damon-Family.org> - 2015-04-25 10:57 -0400
csiph-web