int x = 5;
f(x);
// WHAT IS THE VALUE OF X HERE?
if you really want to make sure that x is not changed by f, declare it const. Sure, f can cast the constness away, but then again it could also walk up the stack in C and trash your stack frame anyway. It is UB in either case.The typesystem in C++ can help protect against Murphy, but (unfortunately) not Machiavelli.