Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #101519
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Function pointers conversions and UB |
| Date | 2017-01-12 13:45 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87pojsqtmx.fsf@bsb.me.uk> (permalink) |
| References | <o564ak$fjf$1@dont-email.me> <o57rhu$ioj$1@dont-email.me> |
Noob <root@127.0.0.1> writes: > On 11/01/2017 21:26, Noob wrote: <snip> > Are "void (*)(void *)" and "void (*)(struct s *)" compatible types? > > It boils down to the function parameter: > > Are "void *" and "struct s *" compatible types? > > I think: "no", but I can't find definitive C&V... unless this? Definitely no. Type compatibility is very strict: char is not even compatible with one of signed char and unsigned char. > 6.2.7 p1 Compatible type and composite type > "Two types have compatible type if their types are the > same. Additional rules for determining whether two types are > compatible are described in 6.7.2 for type specifiers, in 6.7.3 for > type qualifiers, and in 6.7.5 for declarators." > > A type has a type? /me brain exploded I think that's a typo that comes from incomplete editing. Maybe it once said something like "[t]wo values have compatible type if their types are the same" and someone decided to focus on the types (since types exists independently of values or objects) and failed to change "their" to "the". tl;dr: type compatibility is exact type equality with a few tweaks. -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Function pointers conversions and UB Noob <root@127.0.0.1> - 2017-01-11 21:26 +0100
Re: Function pointers conversions and UB "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-11 15:57 -0500
Re: Function pointers conversions and UB supercat@casperkitty.com - 2017-01-11 14:37 -0800
Re: Function pointers conversions and UB jt@toerring.de (Jens Thoms Toerring) - 2017-01-11 21:46 +0000
Re: Function pointers conversions and UB Keith Thompson <kst-u@mib.org> - 2017-01-11 13:51 -0800
Re: Function pointers conversions and UB "James R. Kuyper" <jameskuyper@verizon.net> - 2017-01-11 17:06 -0500
Re: Function pointers conversions and UB Noob <root@127.0.0.1> - 2017-01-12 00:29 +0100
Re: Function pointers conversions and UB Richard Heathfield <rjh@cpax.org.uk> - 2017-01-11 23:37 +0000
Re: Function pointers conversions and UB supercat@casperkitty.com - 2017-01-11 21:49 -0800
Re: Function pointers conversions and UB Richard Heathfield <rjh@cpax.org.uk> - 2017-01-12 09:41 +0000
Re: Function pointers conversions and UB Noob <root@127.0.0.1> - 2017-01-12 10:52 +0100
Re: Function pointers conversions and UB Richard Heathfield <rjh@cpax.org.uk> - 2017-01-12 09:58 +0000
Re: Function pointers conversions and UB Noob <root@127.0.0.1> - 2017-01-12 13:08 +0100
Re: Function pointers conversions and UB Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-12 13:45 +0000
csiph-web