I was looking up examples containing “NEAR PTR”, but they were easily replaceable with “PTR”. Is there any advantage for using “NEAR PTR”?
相关问题
- Null-terminated string, opening file for reading
- What's the difference between 0 and dword 0?
- Translate the following machine language code (0x2
- Where can the code be more efficient for checking
- NASM x86 print integer using extern printf
相关文章
- masm 将负数存于ECX与0比较出错
- Is it possible to run 16 bit code in an operating
- How to generate assembly code with gcc that can be
- Select unique/deduplication in SSE/AVX
- Optimising this C (AVR) code
- Why does the latency of the sqrtsd instruction cha
- Difference in ABI between x86_64 Linux functions a
- x86 instruction encoding tables
NEAR is a legacy from 16-bit past. Assuming your code is 32-bit or 64-bit, they are the same.
This is about memory segments (Wikipedia link to x86 32-bit and to 64-bit).
In LABEL statement both PTR and NEAR PTR just store a 32/64 bit memory address without segment.
If compile next code under 64-bit MASM:
and check under Visual Studio debugger the sizes:
Indeed PTR occupies 8-byte (64 bit), same way as NEAR PTR does.