-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add (void *)
cast directly to GetProcAddress
calls.
#103354
Conversation
#if defined(__GNUC__) | ||
// Workaround GCC warning from -Wcast-function-type. | ||
#define GetProcAddress (void *)GetProcAddress | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it wouldn't be better to put this in typedefs.h
so it's always available.
Since it compiles fine on MSVC without (void *)
it might be easy to miss in future additions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GCC build in CI should always catch feature additions (and I guess clang-cl as well from now), and I do not think all Windows specific files include typedefs.h
, so not sure if it's better. Also, some parts of the code were alredy using direct (void *)
cast.
Thanks! |
From a language standard perspective there is no guarantee that code pointers and data pointers have the same size. It just so happens that on all major OS used on the common x86, x64, arm and arm64 architectures they do have the same size, so this does work. But if we wanted to be nitpicky, this is undefined behavior. By the way this is the reason why you have the cast in the first place, because GCC warns about exactly this. |
|
No description provided.