3 ms·
Trying this with GCC gives me a segfault (although I had to go higher up to 8 MB). #include <stdio.h> int main(void) { char x[8388608]; pr
by lobster_johnson 14y ago
Trying this with GCC gives me a segfault (although I had to go higher up to 8 MB).
#include <stdio.h>
int main(void) {
char x[8388608];
printf("%ld\n", sizeof(x));
return 0;
}
- TazeTSchnitzel 14y agoMy point was that Visual C++ 2010 gives a different error, but it was running in debug mode.
- lobster_johnson 14y agoAnd my point was that GCC was not as helpful in that case. :-) With the GNU C library you will have to install your own signal handlers and jump through a lot of hoops to get anything more sensible than a "segmentation fault" error. You would think our tools would be a bit more modern by now.
- TazeTSchnitzel 14y agoOh by the way, I'm not sure if it was exactly 5MB, it might actually have been 2MB. This particular case was 2 years ago, now.