Why does casting a function generate a run-time abort?
Ziemowit Laski
zlaski@apple.com
Fri Jun 18 07:32:00 GMT 2004
On 17 Jun 2004, at 22.55, Eric Botcazou wrote:
>> Could someone shed some light on this?
>
> The behaviour is undefined in C at run-time (6.3.2.3 §8) so generating
> an
> abort is permitted. This should not trigger in Objective-C (at least
> that's
> how it was written for 3.4).
Right; there is an ugly 'if(!c_dialect_objc())' in front of the whole
thing. Although I do see that an abort is indeed permitted under the
circumstances, I'm still mystified as to why this became an issue in
the first place. Why not just construct a function call using the
signature specified in the cast? Aside from not being able to inline
the call, I'm not quite sure what the problem is...
> For the records, Geoff first suggested a compile-time abort, then
> Joseph
> pointed out that this was only undefined at run-time, hence the
> run-time
> abort (modelled on the va_arg stuff).
Yes, that's what my sleuthing uncovered also. :-)
--Zem
More information about the Gcc
mailing list