- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 688
 
Fixing compiler warnings around implicit type casting loosing precision #650
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
Fixing compiler warnings around implicit type casting loosing precision #650
Conversation
da08460    to
    2699830      
    Compare
  
    | 
           Ok, so CI fails for mingw because its expecting a library ending on  All the warnings I'm still looking into can be found in the CI for Windows, they won't fail the CI  | 
    
| namespace godot { | ||
| 
               | 
          ||
| struct Transform2D; | ||
| class Transform2D; | 
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.
It's a struct, right? Why change this?
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.
No, it's defined as a class. Look up Transform2D.hpp, unless that is our real issue here.
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.
Why does godot-cpp use class Transform2D but the engine uses struct?
I apologize if this is off-topic, but this change seems very weird to me.
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.
To be honest, no idea, probably because we just generate everything as classes, @vnen is this something we should change?
2699830    to
    1c8d331      
    Compare
  
    | 
               | 
          ||
| inline Vector2i operator*(const float &p_scalar, const Vector2i &p_vector) { | ||
| return p_vector * p_scalar; | ||
| float x = (float)p_vector.x * p_scalar; | 
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'm not sure about making this change, it's more accurate allowing you to multiply a vectori with say 0.5 to half the sizes, but its also slower.
| 
           Anyone have any idea how to silence these types of warnings? I really have no idea what the compiler is trying to tell me what is wrong here.  | 
    
| 
           @BastiaanOlij You missed the actual warning,  So the problem is   | 
    
1c8d331    to
    b4066e4      
    Compare
  
    | 
           @akien-mga ah, and that one was really pointing at the wrong line of code because it's a macro and MSVC errors on macros are useless. I think I've got it though :)  | 
    
| 
           Compiling the test project on CI doesn't seem to work well yet, there's some linking issues on macOS and MinGW. Edit: And actually the "Windows MinGW" build is using MSVC... Could be split to a separate PR if you want to merge the warning fixes anyway.  | 
    
          
 The problem in both is that it's expecting a different extension for the godot-cpp library. I'll have a look if I can fix that up  | 
    
5fb56ae    to
    d6819a1      
    Compare
  
    d6819a1    to
    94efe3d      
    Compare
  
    | 
           Thanks!  | 
    
Just working on removing some compiler warning for the test project. Only tested this on Windows so far.
Also added compiling test project to CI