[ create a new paste ] login | about

Link: http://codepad.org/Aiwmy0ZH    [ raw code | output | fork ]

C++, pasted on Apr 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <string>
#include <sstream>
#include <cassert>

int main()
{
    std::istringstream stream( "-1" );
    std::cout << "flags: " << (unsigned long)stream.flags() << std::endl;

    unsigned short n = 0;
    stream >> n;
    cout << "sz us" << (size_t)(sizeof n) << " :: " << n;
    
   // assert( stream.fail());
    //std::cout << "can't convert -1 to unsigned short" << std::endl;
    return 0;
}


Output:
1
2
flags: 4098
sz us2 :: 0


Create a new paste based on this one


Comments: