Sujet : Call to a function De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram) Groupes :comp.lang.c Date : 22. Sep 2023, 13:24:28 Autres entêtes Organisation : Stefan Ram Message-ID :<call-20230922130647@ram.dialup.fu-berlin.de>
When "1" is cast to a function type and then this is called, one would expect this call to have undefined behavior. But I can only find this in the C specification:
|If a converted pointer is used to call a function whose type |is not compatible with the referenced type, the behavior is |undefined.
. At the address "1" there is not "a function whose type is not compatible", but no function at all. Is "no function at all" also "a function whose type is not compatible with the referenced type" or is there some other part of the specification by which a call to an address where there is no function at all has UB?
Then, when "f()" is being evaluated and there is no UB, I'd expect the control to temporarily be transfered to f. The C spec has a section "Function Calls" under "Postfix Operators", but I cannot find anything there that actually says this.