decimad / luabind-deboostified

Create Lua bindings for your C++ code easily - my improvements
http://www.vrac.iastate.edu/vancegroup/docs/luabind/
Other
71 stars 26 forks source link

Compiler warning MSVC12 (VS2013 RTM) x64 #3

Closed tripleslash closed 10 years ago

tripleslash commented 10 years ago
1>luabind/detail/conversion_policies/native_converter.hpp(114): warning C4244: 'Argument': Conversion from 'const unsigned __int64' to 'lua_Number', possible loss of data
1>          src\class_info.cpp(99): See "luabind::adl::index_proxy<luabind::adl::object> luabind::adl::object::operator []<size_t>(const T &) const".
1>          with
1>          [
1>              T=size_t
1>          ]
decimad commented 10 years ago

Thank you for the report! Should __int64 not qualify as a native integer part? I wonder what the best solution would be. Either it's handled as a user type or it is implicitly converted to "double" (most of the times lua_Number is double anyways), in which case I would prefer the warning to stay, since it introduces a possibility of failure. A solution may be to check the bounds of the actual number given and throw if the number gets too large to be represented with a double (or what lua_Number is defined to be).

Thanks again!

tripleslash commented 10 years ago

A pragma warning disable would work as well then :D

tripleslash commented 10 years ago

This can be fixed by just adding a static_cast around the value in native_converter.hpp. I just prefer to have no warnings in my build.