[[lesson_5_overflow.cpp]] Rescued by C++ Reloaded

Route:


[user02@FC4 Lesson05]$ cat -n overflow.cpp
1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int positive = 40000; 7 long big_positive = 4000000000; 8 char little_positive = 210; 9 10 cout << "positive now contains " << positive << endl; 11 cout << "big_positive now contains " << big_positive << endl; 12 cout << "little_positive now contains " << little_positive << endl; 13 14 return 0; 15 }
[user02@FC4 Lesson05]$ g++ -o overflow overflow.cpp
overflow.cpp:7: warning: this decimal constant is unsigned only in ISO C90
[user02@FC4 Lesson05]$ ./overflow
positive now contains 40000
big_positive now contains -294967296
little_positive now contains O
lesson_5_overflow.cpp, Rev. 1, Last changed on 2005-08-08 04:35, 278 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.182 seconds || || PAGERANK TOOLS