-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix some compilation warnings #718
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
base: main
Are you sure you want to change the base?
Fix some compilation warnings #718
Conversation
8b242b4
to
624c744
Compare
I'm reporting the macos, msvc and premake errors reported by the CI to bmorel. |
02ec38e
to
8c1eb0a
Compare
The remaining error happening with premake on Linux doesn't seem to be introduced by this branch:
|
8c1eb0a
to
3dc4e55
Compare
See this another PR for an attempt to fix that: |
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.
Thank you! Love this change! Especially using RC_NULL
rather than 0
makes the code a lot clearer. There's a few small things I'd love to tweak a bit before merging it.
dtTileCacheAlloc& operator=( dtTileCacheAlloc const& ) = default; | ||
dtTileCacheAlloc( dtTileCacheAlloc && ) = default; | ||
dtTileCacheAlloc& operator=( dtTileCacheAlloc && ) = default; | ||
#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.
Is this strictly necessary?
If it is, is there a version of this that would work for C++98 as well?
{ | ||
dtAssert( std::numeric_limits<TO>::min() <= val && val <= std::numeric_limits<TO>::max() ); | ||
return static_cast<TO>( val ); | ||
} |
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.
This doesn't seem only applicable to "modern C++", so I'd be cool moving this to a DetourCommon.h
Also, I think a name like dtSafeNumericCast
or dtCheckedNumericCast
would be more appropriate here since this only works for numeric types, and it's checking that the value can be casted to the new type without losing information.
{ | ||
rcAssert( std::numeric_limits<TO>::min() <= val && val <= std::numeric_limits<TO>::max() ); | ||
return static_cast<TO>( val ); | ||
} |
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.
Same thoughts here as the Detour version...
Some warning fixes by a contributor of Unvanquished, initially pulled from:
I modified the first commit commit of that branch to:
chmod
change to a dedicated commit,