Which one i should use to do 64-bit pointer math for Delphi,, NativeUInt or NativeInt -


since there 64-bit delphi compiler, should use 64-bit pointers.

so wondering difference if use nativeint or nativeuint. example,

should use

pointer(nativeuint(pointer(buffer)) + longword(datawrote))^, 

or

pointer(nativeint(pointer(buffer)) + longword(datawrote))^, 

does matter? better style?

the simplest thing cast pointer pbyte. can perform arithmetic on that:

pbyte(buffer) + offset 

that expression of type pbyte , may need cast other pointer type.

as general rule, pointers not integers , should resist temptation convert cast them integers. best let pointers pointers. can perform pointer arithmetic on pansichar, pwidechar , pbyte, , other pointer types can use {$pointermath on} enable pointer arithmetic.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -