Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2003-11

IntToHex difference

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

David Butler

Hi

A small difference between FreePascal and Delphi's IntToHex function:

FreePascal's IntToHex function interprets the Digits parameter as the 'maximum number of digits'. Delphi interprets it as the 'minimum number of digits'.

For example, FreePascal IntToHex($10, 1) = '0', whereas Delphi returns '10'. IntToHex($10, 3) = '010' on both compilers.

Regards
David

Reply by email

Johannes Berg
to David Butler
David Butler wrote
A small difference between FreePascal and Delphi's IntToHex function:

According to the docs, FPCs behaviour is wrong.

--quote--
If \var{Digits} is less than the needed number of characters, the string will NOT be truncated. If \var{Digits} is larger than the needed number of characters, the result is padded with zeroes. --end quote--

johannes

http://www.sipsolutions.de/ GnuPG key: http://www.sipsolutions.de/keys/JohannesBerg.asc Key-ID: 9AB78CA5 Johannes Berg Fingerprint = AD02 0176 4E29 C137 1DF6 08D2 FC44 CF86 9AB7 8CA5

Reply by email