[serialization] size_t vs unsigned warnings
Hi Line 36 in collections_save_imp.hpp says: unsigned int count = s.size(); I'm getting many pages of warnings in VC++2005 stemming from this line. Would it make sense to change that to std::size_t count = s.size() ? If so, should I just edit the line? recompile boost? I'd like to take care of that warning. Thanks
n.torrey.pines wrote:
Hi
Line 36 in collections_save_imp.hpp says:
unsigned int count = s.size();
I'm getting many pages of warnings in VC++2005 stemming from this line. Would it make sense to change that to
std::size_t count = s.size() ?
No. size_t is a typedef. It could map to unsigned int on one version of the compiler and to unsigned long on another. Saving something as an unsigned int and loading it as an unsigned long is not guaranteed to work. By making this change, you may be introducing a subtle forward compatibility issue into your data files.
Note that this is addressed in 1.35. n.torrey.pines wrote:
Hi
Line 36 in collections_save_imp.hpp says:
unsigned int count = s.size();
I'm getting many pages of warnings in VC++2005 stemming from this line. Would it make sense to change that to
std::size_t count = s.size() ?
If so, should I just edit the line? recompile boost? I'd like to take care of that warning.
You could do this - I don't think it require recompiling boost since the header isn't (or at least shouldn't be) part of a compiled part of the library. I'm not sure what the warning says. But if you change the size of count, you might have a problem. Maybe you might just want to cast the result of s.size to unsigned int.
Thanks
Note that this is addressed in 1.35. n.torrey.pines wrote:
Hi
Line 36 in collections_save_imp.hpp says:
unsigned int count = s.size();
I'm getting many pages of warnings in VC++2005 stemming from this line. Would it make sense to change that to
std::size_t count = s.size() ?
If so, should I just edit the line? recompile boost? I'd like to take care of that warning.
You could do this - I don't think it require recompiling boost since the header isn't (or at least shouldn't be) part of a compiled part of the library. I'm not sure what the warning says. But if you change the size of count, you might have a problem. Maybe you might just want to cast the result of s.size to unsigned int.
Thanks
participants (3)
-
n.torrey.pines
-
Peter Dimov
-
Robert Ramey