Why does an EXE file that does *nothing* contain so many dummy zero bytes?

Posted by Lambert on Stack Overflow See other posts from Stack Overflow or by Lambert
Published on 2011-01-05T09:46:07Z Indexed on 2011/01/05 9:53 UTC
Read the original article Hit count: 255

Filed under:
|
|
|
|

Hi,

I've compiled a C file that does absolutely nothing (just a main that returns... not even a "Hello, world" gets printed), and I've compiled it with various compilers (MinGW GCC, Visual C++, Windows DDK, etc.). All of them link with the C runtime, which is standard.

But what I don't get is: When I open up the file in a hex editor (or a disassembler), why do I see that almost half of the 16 KB is just huge sections of either 0x00 bytes or 0xCC bytes? It seems rather ridiculous to me... is there any way to prevent these from occurring? And why are they there in the first place?

Thank you!

© Stack Overflow or respective owner

Related posts about c

    Related posts about null