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

compile discrete_distribution for 64-bit code #46

Open
Fuzzier opened this issue Oct 2, 2018 · 1 comment
Open

compile discrete_distribution for 64-bit code #46

Fuzzier opened this issue Oct 2, 2018 · 1 comment

Comments

@Fuzzier
Copy link

Fuzzier commented Oct 2, 2018

When compiling discrete_distribution using MSVC 2010 64-bit compiler, warnings are emitted.
The key warning says:
warning C4267: 'argument' : conversion from 'size_t' to 'int32_t', possible loss of data

Cause of the issue:
In random/discrete_distribution.hpp, at line 507, the expression _impl.get_weight(i) tries to convert 'i' (a 'size_t') into 'IntType' (the parameter type of get_weight()).
However, 'IntType' is 'int' by default, which causes a conversion from 64-bit to 32-bit in a 64-bit environment.

Suggestions:
At line 499, 'i' is defined as a 'size_t'.
It should be safe to define it as an 'IntType':
IntType i = 0;.

@drauch
Copy link

drauch commented Oct 28, 2018

MSVC 2010 is not supported by Boost, so it will probably not get fixed. See also https://www.boost.org/doc/libs/1_66_0/libs/convert/doc/html/boost_convert/supported_compilers.html for more information.

And god help us, please update your compiler :-) The same is true for #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants