News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Pointer addr question

Started by xoreaxeax, July 27, 2012, 12:37:21 AM

Previous topic - Next topic

xoreaxeax

I just want to be sure, but is there any chance at all a valid pointer addr could equal 0?  Does the assembler/linker make sure that never happens?

hutch--

No. A pointer address cannot be lower than the minimum address specified in the OS. Address 0 is an error in win 32. On my XP Sp3 the lowest address is 100000 hex.

dedndave

sometimes, a pointer of 0 or NULL is used to indicate the absence of a value
for example, some functions will fill a POINT structure if you provide an address
if you pass a NULL value, it will omit that feature
other times - i may set a pointer to 0 to indicate that it isn't filled in, yet

otherwise.....
a pointer of 0 will undoubtedly get you a crash and a look at Dr Watson or a maybe a debugger   :biggrin:

npnw

Couldn't it also depend on where he is in the program cycle. What about  dd (0) in the program header. Then if a pointer  is pointing to another it would be init with 0 or null to begin, so it could be garbage. Then as you were saying Dave it would fill it in with a valid address later on.

What about runtime pointer allocation on the fly? They could be set to a value such as 0 and then dynamically linked on the fly with a valid pointer.  I guess it depends on what pointer you were looking at and when.