[fpc-devel] StrToInt -- Strange behaviour

Ewald ewald at yellowcouch.org
Thu Feb 21 21:01:23 CET 2013


Hello,

Try running the following program and be amazed of the output:

    Program Test;

    Uses Sysutils;

    Begin
        WriteLn(StrToInt('x1'));
        WriteLn(StrToInt('x0'));
        WriteLn(StrToInt('xabcdef'));
    End.


Apparently the StrToInt function interprets strings starting with an `x`
as hexadecimal numbers? This behaviour seems rather strange to me
(strings starting with 0x would be a bit more understandable, but then
again, we're programming pascal here, not C) and it is not mentioned in
the documentation. What do I do with it?

A- File a bug concerning incomplete documentation?
B- File a bug concerning incorrect behaviour of StrToInt()?
C- Do nothing and live with it.
D- ....?


Additional information
 Compiler Version: 2.6.0

-- 
Ewald

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130221/d774ef67/attachment.html>


More information about the fpc-devel mailing list