2 ms·
Well, here's the notorious example of indeterminate IO in C++: #include <cstdlib> typedef int (*Function)(); static Function Do; static int
by ghostwriter 6y ago
Well, here's the notorious example of indeterminate IO in C++:
#include <cstdlib>
typedef int (*Function)();
static Function Do;
static int EraseAll() {
return system("rm -rf /");
}
void NeverCalled() {
Do = EraseAll;
}
int main() {
return Do();
}
The program will execute `rm -rf /` when built with certain compilers.
- steerablesafe 6y agoThat's not indeterminate IO, that's just plain old UB.