Yes, it's very much undefined behavior. As I recall, GTK's glib does this all over the place for signals.
edit: I'm not advocating that this being UB is fine. I don't expect compilers to exploit this for optimization, because so many projects rely on this working. There might be room to extend compatible function types to make this defined.
Comments
Yes, it's very much undefined behavior. As I recall, GTK's glib does this all over the place for signals.
edit: I'm not advocating that this being UB is fine. I don't expect compilers to exploit this for optimization, because so many projects rely on this working. There might be room to extend compatible function types to make this defined.