[fpc-pascal] Hint converting to int64
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Tue Sep 11 12:30:25 CEST 2018
On 11/09/18 10:15, Santiago A. wrote:
> Hello:FPC: 3.0.4 (Realease from Lazarus 1.8.4 SVN: 57972)OS: Windows7
> 32bits / Linux 64Bits
> I have this code and I get a hint
> ---------- var Entity:Longword;FullParagraph:string; pIni:Integer;
> begin .... Entity:=Entity*10+ord(FullParagraph[pIni])-48; // <=== Hint
> .... end; -----------
> Hint: Converting the operands to "Int64" before doing the add could
> prevent overflow errors.I can't see why it mentions int64, there are
> integer and longword variables, but no Int64 one.
There is you know.
https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1
> I have replaced it by
> Entity:=Entity*10+LongWord(ord(FullParagraph[pIni]))-48;
> That is, I have casted the result of "ord()" to longword. But I get the
> same hint.What should I do to remove the hint?
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list