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
Avoid compiler warning when sscanf writes qboolean through %i #872
Conversation
smcv
commented
Sep 25, 2016
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.
Perhaps there should be a qbool_cast kind of function/macro, which takes some type, and converts it to qfalse or qtrue? Instead of having the ternary operator for qfalse/qtrue everywhere.
Fair point. |
I started replacing I don't think that's a change that I can be confident to have got right every time, and it's going to be even more boring for you to review than it is for me to do, so catching my mistakes seems unlikely. I don't want to make that change without being absolutely sure that it's the direction you want OpenJK to go in. I suspect OpenJK might actually be better off moving to ISO C++ |
|
I think VS2013 is/should be our minimum VS required. Didn't we remove the < 2013 project generators? My concern over EDIT: I did not mean to close this >_< hit the wrong button |
There appear to be batch files for 2013 and 2015. I don't know whether anyone builds with older, and if so, whether you'd make any effort to support it.
Strictly speaking I don't think enums are actually required to be 4 bytes, although any sane compiler vendor will make them 4 bytes because otherwise everyone else whose code makes that assumption will refuse to use that compiler. I would tend to assume that anything that reads qbooleans directly from files or network packets is going to have problems with endianness anyway, so all reads/writes involving qboolean should probably be reading a I can see that there'd be a problem with this approach where we pass pointers to structs across the game/cgame/ui DLL boundary, where we have to stick to the traditional ABI. Any booleans in those structs probably do need to stay One possible approach would be to replace
As far as I can see, this is what the qboolean enum is meant to prevent: it forces you to use If non-boolean values in allegedly boolean variables are necessary, the other potential route is to admit defeat and have It's looking as though this isn't going to be fixed immediately, so would it be OK to merge my patch (which silences some warnings and at least doesn't make the situation worse), and work incrementally towards a solution? |
.../code/game/g_client.cpp:760:6: warning: format '%i' expects argument of type 'int*', but argument 26 has type 'qboolean*' [-Wformat=]
|
Updated branch fixes one more instance of the same issue. |
Avoid compiler warning when sscanf writes qboolean through %i Former-commit-id: d00931e
Avoid compiler warning when sscanf writes qboolean through %i