Writing a library that works with function callbacks, I've frequently type-casted (and called) function pointers to types with the same calling convention and same signatures, but with one exception: they had parameters pointing to different types (all data), or void pointers.
Recently, I discovered that it might not be that safe, according to this: https://stackoverflow.com/a/14044244/3079266
Basically, as I understood it, if the types of the arguments are compatible, that means the function pointer types are also compatible, and there should be no problem.
Now, I've got 3 questions.
First: does this mean that, since pointers to different types are technically incompatible, what I am doing can cause undefined behaviour?
Second: where (on what architectures) can I get away with it? Are Windows x86 or x64 versions among them?
Third: where can I NOT get away with it?