-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Compiler warning about printing ImTextureID #2548
Comments
Can't we just cast the value at the printf call site? |
We can, but we'll get something like "0x5", as if it was address, instead of just "5". (ImTextureID in ImGui-SFML is OpenGL's texture handle). But yeah, it's better than nothing. :) |
This is fine. This printout is merely a debugging/auditing tool, if we wanted to decorate this properly we'd need higher level primitives (e.g. query texture name from id). 0x5 is hexadecimal, it doesn't mean it is an address. |
Okay, thanks! |
Hello, I've ignored this warning for quite some time, but I think that it's easy to deal with, but needs some discussion. Basically, it's this:
Here, the problem is that ImTextureID is assumed to be
void*
, but in custom bindings another type may be used. In ImGui-SFML, it'sunsigned int
.So, the way to deal with this is to make "0x%p" part of this format string modifiable. We can have something like
ImTextureIDPrintSpecifier
to allow bindings to define howImTextureID
should be printed. It can be "0x%p" by default, same asImTextureID
isvoid*
by default.Thoughts?
The text was updated successfully, but these errors were encountered: