Having written a library that works with function callbacks, I often type (and call) pointers to types with the same call and the same signatures, but with one exception: they had parameters pointing to different types (all data) or void pointers.
I recently discovered that this might be unsafe, according to this: https://stackoverflow.com/a/464618/
In principle, as I understand it, if the types of arguments are compatible, this means that the types of function pointers are also compatible, and there should be no problems.
Now I have 3 questions.
First: does this mean that since pointers to different types are technically incompatible, what am I doing can cause undefined behavior?
Secondly: where (on which architectures) can I deal with it? Are there versions of Windows x86 or x64?
Third: where can I not avoid this?
source
share