"Conversion between ordinals and pointers is not portable" is misleading
Original Reporter info from Mantis: chebmaster
-
Reporter name:
Original Reporter info from Mantis: chebmaster
- Reporter name:
Description:
"Conversion between ordinals and pointers is not portable" should be "Fixed-bitness pointer math detected, not portable" or "There is a stray longint in your pointer math, check your type-casts" or something equally informative.
I was under false impression this warning was referring to pointer arithmetic in general being not portable to platforms with no pointers so I struggled for many years trying and failing to port my game engine to x86-64. It kept crashing horribly while I kept ignoring humongous herds of these warnings.
Steps to reproduce:
Be a "A true Jedi needs no manuals" fool like me.
Forget what "ordinals" are, think it's a generic fancy name for unsigned integers of any bitness.
Additional information:
//My original faulty code:
f_Size: longint
[...]
function TChepersyMemoryManagerChunk.Alloc: pointer;
var k: integer;
[...]
Exit(pointer(ptruint(Self) + ptruint(k) * f_Size));
//My fixed code (warning disappeared):
Exit(pointer(ptruint(Self) + ptruint(k * f_Size)));
Would be worth nothing if I was a newbie, but I am a foolish but still experienced hobbyist coder who started using Turbo Pascal as far back as 1988 and Free Pascal since version 1.1 (a year or so before 1.9). My best and lost achievement (a true Jedi needs no backups) was a multi-threaded game engine for MS-DOS written in Turbo Pascal + Turbo Assembler that was using a timer interrupt handler to switch thread contexts.
Mantis conversion info:
- Mantis ID: 36792