if allocate() returned -1 on failure...

new topic     » topic index » view thread      » older message » newer message

...how much legacy code would break?

Obviously any if mem=NULL would need to become if mem<=NULL - while 32-bit always returns +ve successes, I might also need to tweak 64-bit to do the same.
Or perhaps make that if odd(mem)... - which has a certain ring to it!

One trick I often use is pMem4 = allocate()/4: since it is always dword-aligned (or qword-aligned on 64-bit), no bits are lost and it is guaranteed to fit in a 31/63-bit integer.
It certainly simplifies hll-allocated memory for use by inline assembly, which just has to shl 2 rather than suck a >31/63 bit address out of an IEEE754.
If allocate returned -1 on failure, instead of the 0 it currently does, that trick would also automatically typecheck on error...

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu