GLScene icon indicating copy to clipboard operation
GLScene copied to clipboard

MaxInt is non-platform-adjustable, example: Array indexes limited to 32 bits shr 4

Open SkybuckFlying opened this issue 1 year ago • 0 comments

Examples of code:

I am not sure if this is an actual limitation. Since maybe these arrays allocated dynamically.

I am currently busy trying to declare an array type, purely for debugging purposes.

A typed pointer only cannot be debugged easily in the way of an array, so I was hoping that GLScene would give a nice example of how to declare it but then I ran into this and discovered this potential limitation.

I am not sure what the real/current limitation is of arrays in Delphi 10.3.2, which is what I am using.

Anyway, perhaps this is something that should be looked into.

I at least looked into MaxInt and it says 2 billion on win32 and win64 platform and the latter is maybe incorrect and a problem.

const cMaxArray = (MaxInt shr 4);

(* Types to specify continous streams of a specific type switch off range checking to access values beyond the limits *) PByteVector = ^TByteVector; PByteArray = PByteVector; TByteVector = array [0 .. cMaxArray] of Byte;

PWordVector = ^TWordVector; TWordVector = array [0 .. cMaxArray] of Word;

PIntegerVector = ^TIntegerVector; PIntegerArray = PIntegerVector; TIntegerVector = array [0 .. cMaxArray] of Integer;

PFloatVector = ^TFloatVector; PFloatArray = PFloatVector; PSingleArray = PFloatArray; TFloatVector = array [0 .. cMaxArray] of Single; TSingleArray = array of Single;

SkybuckFlying avatar Aug 27 '22 16:08 SkybuckFlying