Files
Cpp-in-Embedded-Systems/Chapter01/undefined_behavior.cpp
Amar Mahmutbegovic de6d74e093 add Chapter01 examples
2024-04-27 20:43:40 +02:00

17 lines
277 B
C++

#include <cstdio>
#include <limits>
int foo(int x) {
int y = x + 1;
return y > x;
}
int main() {
if (foo(std::numeric_limits<int>::max())) {
printf("X is larger than X + 1\r\n");
} else {
printf("X is NOT larger than X + 1. Oh nooo !\r\n");
}
return 0;
}