Hacker News new | ask | show | jobs
by lell 5315 days ago
Indeed, this crashed my gcc. How does it work? If I had enough memory would it terminate? looks like it.
1 comments

Because the structure is initialized, the compiler has to lay it out in memory, and fill out the fields.

If it was left uninitialized, it would've simply reserve space for it, but won't allocate anything in memory (compiler memory), and then the linker is just going to increase the BSS section (uninitialized data) with it's size.

Later the program may or may not run. Some systems might allow many gigabytes of uninitialized data. Others simply won't.