I sometimes use this in my code:

mov edi, lpStart
loop: ...
inc edi
cmp edi, lpEnd
jl loop

until my friend wonders, if the pointer can be larger than 2 GByte
and I must use "jb" instead of "jl".

Can pointers (mostly from xxxAlloc) be as large?
Posted on 2001-09-25 11:21:19 by beaster
Never assume anything, go with the jb...
I don't know the exact ranges of allocated memory, it also depends on the OS... But as pointers are values that can point anywhere in the 4gig address space, jl may simply not be used.

Posted on 2001-09-25 12:09:22 by Thomas
"Always, Always use jb, jbe, ja, jae for numbers
that will always be positive."
"Always, Always use jl, jle, jg, jge for numbers
that might be positive or negative."

I don't know why originally I posted that note,
but if it's up there it's because I spent more
than 2 hours tracking down a program-killing bug.

Posted on 2001-09-26 03:49:47 by farrier
after detecting the error at first I was shure that its a major bug,
but since never one error occured in my 3000 pages of sourcecode, I asked myself why not. Seems that at least under
Win9x Windows occupies the upper 2 GByte area and all allocated
pointers resist in the lower address range.

my > 2 hours experiences have burned directly inside my brain ...
Posted on 2001-09-26 04:44:57 by beaster
Windows NT/2k (and probably XP as well) and Win 9x/ME reserve the upper 2G for system use. This is primarily for compatibility with NT implementations on the MIPS chip.
Posted on 2001-09-26 13:25:19 by tank
But isn't this "system area" also used for shared memory? (DLL,
memory mapped files, and such)?

Anyway, for pointer compares, I'd *always* use the unsigned Jcc's.
Posted on 2001-09-26 13:57:30 by f0dder