开发者

How does MASM .DATA? directive work internally [duplicate]

This question already has an answer here: How to see the memory occupied by initialised array vs uninitialised array (1 answer) 开发者_如何学Python Closed 5 years ago.

In Kip Irvines book I came across the following :

The .DATA? directive declares uninitialized data. When defining a large block of uninitialized data, the .DATA? directive reduces the size of a compiled program. For example, the followingcode is declared efficiently:

.data?

bigArray DWORD 5000 DUP(?) ; 20,000 bytes, not initialized

The following code, on the other hand, produces a compiled program 20,000 bytes larger:

.data

bigArray DWORD 5000 DUP(?) ; 20,000 bytes

What exactly is the .data? directive doing under the hood in the above example to make the program 20k smaller.


The uninitialized data need not be in the compiled binary, just a byte count that the OS loader allocates at run-time when executing your program.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜