Skip to content
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

Fix compiler warnings caused by implicit type conversion (fixes #3677) #3729

Merged
merged 3 commits into from
Jan 7, 2021

Conversation

btrotta
Copy link
Collaborator

@btrotta btrotta commented Jan 5, 2021

Fix compiler warnings C4244 and C4267

@btrotta btrotta added the fix label Jan 5, 2021
@btrotta btrotta changed the title Fix compiler warnings caused by implicit type conversion (fixes #3677) [WIP] Fix compiler warnings caused by implicit type conversion (fixes #3677) Jan 5, 2021
@btrotta btrotta changed the title [WIP] Fix compiler warnings caused by implicit type conversion (fixes #3677) Fix compiler warnings caused by implicit type conversion (fixes #3677) Jan 5, 2021
@StrikerRUS
Copy link
Collaborator

Great! Only few lines are left:

2021-01-05T08:26:16.1022300Z   serial_tree_learner.cpp
2021-01-05T08:26:29.1103930Z   tree_learner.cpp
2021-01-05T08:26:29.1115764Z C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\xutility(2903): warning C4244: '=': conversion from 'const _Ty' to 'float', possible loss of data [D:\a\1\s\build\_lightgbm.vcxproj]
2021-01-05T08:26:29.3073256Z           with
2021-01-05T08:26:29.3912834Z           [
2021-01-05T08:26:29.5125855Z               _Ty=int
2021-01-05T08:26:30.0013145Z           ] (compiling source file D:\a\1\s\src\treelearner\linear_tree_learner.cpp)
2021-01-05T08:26:30.3244783Z   C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\xutility(2917): note: see reference to function template instantiation 'void std::_Fill_unchecked1<_FwdIt,_Ty>(_FwdIt,_FwdIt,const _Ty &,std::false_type)' being compiled
2021-01-05T08:26:30.7134387Z           with
2021-01-05T08:26:31.1602801Z           [
2021-01-05T08:26:31.5463919Z               _FwdIt=float *,
2021-01-05T08:26:32.0704575Z               _Ty=int
2021-01-05T08:26:32.4605207Z           ] (compiling source file D:\a\1\s\src\treelearner\linear_tree_learner.cpp)
2021-01-05T08:26:32.8519676Z   voting_parallel_tree_learner.cpp
2021-01-05T08:26:33.2523229Z   C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.16.27023\include\xutility(2925): note: see reference to function template instantiation 'void std::_Fill_unchecked<float*,_Ty>(_FwdIt,_FwdIt,const _Ty &)' being compiled
2021-01-05T08:26:33.4811651Z           with
2021-01-05T08:26:33.8333686Z           [
2021-01-05T08:26:34.2263103Z               _Ty=int,
2021-01-05T08:26:34.6213071Z               _FwdIt=float *
2021-01-05T08:26:35.0073728Z           ] (compiling source file D:\a\1\s\src\treelearner\linear_tree_learner.cpp)
2021-01-05T08:26:35.3980723Z   D:\a\1\s\src\treelearner\linear_tree_learner.cpp(237): note: see reference to function template instantiation 'void std::fill<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<_Ty>>>,int>(_FwdIt,_FwdIt,const int &)' being compiled
2021-01-05T08:26:35.7825747Z           with
2021-01-05T08:26:36.1753974Z           [
2021-01-05T08:26:36.5593124Z               _Ty=LightGBM::label_t,
2021-01-05T08:26:36.8104822Z               _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<LightGBM::label_t>>>
2021-01-05T08:26:37.1303753Z           ]
2021-01-05T08:26:37.1331979Z   D:\a\1\s\src\treelearner\linear_tree_learner.cpp(124): note: see reference to function template instantiation 'void LightGBM::LinearTreeLearner::CalculateLinear<true>(LightGBM::Tree *,bool,const LightGBM::score_t *,const LightGBM::score_t *,bool) const' being compiled
2021-01-05T08:26:42.3756298Z   c_api.cpp

@btrotta
Copy link
Collaborator Author

btrotta commented Jan 6, 2021

@StrikerRUS Sorry I missed those, fixed now

Copy link
Collaborator

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I can confirm there are no warnings at Windows machine any more. Thanks a lot!

@guolinke guolinke merged commit 753b0e9 into microsoft:master Jan 7, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VS compiler warnings "warning C4244: '=': conversion from 'const _Ty' to '_Ty', possible loss of data"
3 participants