fork download
  1. // Keyword "auto" near critical points.
  2.  
  3. #include <iostream>
  4. #include <typeinfo>
  5. #include <limits>
  6.  
  7. using std::cout;
  8. using std::endl;
  9. using std::numeric_limits;
  10. using std::cerr;
  11.  
  12. int main() {
  13. auto i = 2147483647 /* numeric_limits<int>::max() */ ;
  14. cout << "The type of i is " << typeid(i).name() << endl;
  15.  
  16. int count = 0;
  17. for (auto i = 2147483647;
  18. i < 2147483657 /* numeric_limits<int>::max() + 10 */ ; ++i) {
  19. cout << "i = " << i << " " << endl;
  20.  
  21. if (count > 30) {
  22. cerr << "Too many loops." << endl;
  23. break;
  24. }
  25. ++count;
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 2884KB
stdin
Standard input is empty
stdout
The type of i is i
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647 
i = 2147483647