G
Guest
Hi,
When I try to print the value of a size_t variable in a stream, I get a
warning.
My code looks as follows.
#include <cstddef> //size_t
#include <cstdlib> //EXIT_SUCCESS
#include <iostream>
int main() {
size_t num = 5;
std::cout << num << std::endl;
return EXIT_SUCCESS;
}
When I try to compile - I get
" d:\akkumar\personal\ng\vs7\ngcpp\ngcpp\sizetprint.cpp(8) : warning C4267:
'argument' : conversion from 'size_t' to 'unsigned int', possible loss of
data "
I don't understand this . I am not converting any data here . Is it that
the operator >> is not overloaded for type size_t ? Anyone got any
suggestions to get around this warning ?
When I try to print the value of a size_t variable in a stream, I get a
warning.
My code looks as follows.
#include <cstddef> //size_t
#include <cstdlib> //EXIT_SUCCESS
#include <iostream>
int main() {
size_t num = 5;
std::cout << num << std::endl;
return EXIT_SUCCESS;
}
When I try to compile - I get
" d:\akkumar\personal\ng\vs7\ngcpp\ngcpp\sizetprint.cpp(8) : warning C4267:
'argument' : conversion from 'size_t' to 'unsigned int', possible loss of
data "
I don't understand this . I am not converting any data here . Is it that
the operator >> is not overloaded for type size_t ? Anyone got any
suggestions to get around this warning ?