evaluation of (std::cin >> var) explanation needed.
Hey, I'm picking up C++. I have a question about the evaluation of the following:
Code:
int var;
if(std::cin >> var)
//do something
It's my understanding that this evaluates to true as long as the input is not end-of-file or a non int. But what is it that is returned exactly? Tried this:
Code:
while( (void *ret = (std::cin >> var)) ){
printf("%d, %p, %d\n", var, ret, *((int*)(ret)));
}
I have found out that it's a void* but, it's not an object (hence the cast), well what is it then?