3 ms·
By generating c code that correctly sets memory to call a function with a particular ABI with the given signature. Then it's the normal sort of wrong. Since th
by uxp100 7y ago
By generating c code that correctly sets memory to call a function with a particular ABI with the given signature. Then it's the normal sort of wrong.
Since the spec doesn't speak about FFI at all it seems, I think this is implementation defined behavior, not undefined behavior.
- shakna 7y ago> By generating c code that correctly sets memory to call a function with a particular ABI with the given signature. And it does. The signature is wrong, however, and so the resulting call will be wrong. Since the standard doesn't speak about FFI, and the invalid call is actually in another language's memory, I'd say we're in completely undefined territory here. To try and say that more clearly, I'd still call it undefined behaviour if an invalid type signature in Java calling Go resulted in something going wrong. Java can't know how Go is supposed to react to a fudge in it's internal memory semantics.
- uxp100 7y agoOk, I understand what you mean. In the c spec undefined behavior has a specific meaning that I don’t think applies to this case.