Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64 下 crash 的問題 #4

Open
DaidoujiChen opened this issue Jun 28, 2016 · 0 comments
Open

arm64 下 crash 的問題 #4

DaidoujiChen opened this issue Jun 28, 2016 · 0 comments
Labels

Comments

@DaidoujiChen
Copy link
Owner

參考

重點節錄

Your Objective-C method is not variadic. Therefore any C implementation that you install using class_addMethod() must also be non-variadic. The call site (using the Objective-C method declaration) and the implementation (in your C function) must match. You must write a non-variadic C function to implement the non-variadic Objective-C method declaration, or you must write a variadic C function to implement a variadic Objective-C method declaration.

On arm64, variadic parameters and non-variadic parameters are passed differently. The expected result for a mismatch is undefined noise. Your reverse-order result is a coincidence and is likely to change with different code or compiler optimization. (This is true to some extent on some other architectures as well, but arm64 makes it even worse.)

固定參數數量的 IMP 只可以去接固定參數數量的 Method,
不固定參數數量的 IMP 只可以去接不固定參數數量的 Method,
亂接是不正確的行為.....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant