3 ms·
#include <iostream> int main() { int nope_not_initialized; std::cout << nope_not_initialized << "\n"; } cc1plus: warnings being treated as
by MaulingMonkey 11y ago
#include <iostream>
int main() {
int nope_not_initialized;
std::cout << nope_not_initialized << "\n";
}
cc1plus: warnings being treated as errors
In function 'int main()':
Line 5: warning: 'nope_not_initialized' is used uninitialized in this function
( http://codepad.org/6xrFQZuL http://codepad.org/6xrFQZuL )
Edit: And a C version. Amusingly, it will print "0" if I only use one printf statement:
#include <stdio.h>
int main() {
int nope_not_initialized;
printf("%d", nope_not_initialized);
printf("%d", nope_not_initialized);
}
-142791388-142791388
Exited: ExitFailure 10
( http://codepad.org/TgGfL7QW http://codepad.org/TgGfL7QW )
Edit x2: Apparently "implicit return 0 from main" is only a thing in C++? And here I'd assumed it was some silly carryover from C...
( http://codepad.org/JIH9ZteL http://codepad.org/JIH9ZteL )