Compiler dead space is it all the same ?
#7
(08-20-2023, 09:10 AM)doppler Wrote: The same areas which contain uninitialized memory for storage.  A dumb compiler will just assign the space.  Which shows up as a random segment of the compiling computers memory.
This is incorrect, modern binary formats like PE (Windows) and ELF (Linux) do not take up disk space with uninitiated memory. What actually happens is the compiler will create a memory segment that is listed as larger than its on-disk contents. The "extra space" that doesn't exist on disk is then allocated by the OS as a bunch of zero'd memory.

That said, the produced EXEs or executables are very unlikely to come out the same every time. You _can_ do that with
gcc
, people do, but it requires a little work to ensure that the compiler doesn't embed things like the date of compilation into the program (which will obviously screw it up). You can read about some of the challenges here.

I will say, I don't think QB64-PE uses the
__DATE__
and friends macros anywhere in the source, but I also don't really know for sure.
__FILE__
should only be used if you've turned on some C++ debugging information (you can't turn it on without editing the C++ code, so unlikely). Point being, I think there's a decent chance they could be deterministic just accidentally, but we've never checked and it's typically a hard thing to get right so I doubt it.
Reply


Messages In This Thread
RE: Compiler dead space is it all the same ? - by DSMan195276 - 08-20-2023, 02:56 PM



Users browsing this thread: 7 Guest(s)