Initialization means that the value of that buffer will be the given value on entry to the program. 'rb' reserves bytes, but those bytes are initialized to zero on Linux/Windows, without taking space on disk. So when at your program's entry point, they'll be zeros.

It's like allocating a block of memory containing all your 'rb' stuff and then zero-ing them in a loop before your program's entry point is even executed. (that's what the OS does)

If you used 'db' instead, it would copy them from the disk to the memory block instead of zeroing it, thus if data is zeros, it would waste it on the disk for no reason, since it ends up being zeros in memory anyway.

Note that, as revolution said, you shouldn't mix db with rb in same section/segment. Just put all 'rb' in their separate section/segment.

Note that, as revolution said, you shouldn't mix db with rb in same section/segment. Just put all 'rb' in their separate section/segment.

I was suggesting that if you put the uninitialised data at the end of a segment then the assembler can mark it with just a length. But you can still put initialised data with it as long as it comes first.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum