[fpc-pascal] A simple "exception handling" question
michalis at camelot.homedns.org
Sun Jan 29 06:21:22 CET 2006
Bob Richards wrote:
> Michalis Kamburelis wrote:
>>There's a bug in Hex2Dec implementation -- it returns 0 instead of
>>raising EConvertError. Here's a patch:
>>--- strutils.pp (wersja 2298)
>>+++ strutils.pp (kopia robocza)
>>@@ -1156,7 +1156,7 @@
>> HexStr:='$'+ S
>> function Dec2Numb(N: Longint; Len, Base: Byte): string;
> First, thanks for the reply; I applied the patch, it applied without a problem, verified
> the new StrUtils.pp source, all OK as per the patch. Recompiled strutils.ppu. The function
> still returns a zero on error.
> Is there another patch I need as well?
I'm quite sure that my patch is all you need. I tested it on my system
with your test program hextest, and it fixed the situation. So my guess
is that you're probably mistakenly using old compiled version of
strutils unit instead of the patched one. Check it -- e.g. add some trivial
Writeln('i am the new version');
inside Hex2Dec implementation and see if your hextest prints this message.
You can also just paste the corrected implementation of Hex2Dec inside
your program, this will also fix the bug, without the need to recompile
Of course, ultimately the solution is to wait until this patch will be
applied to FPC sources and then use updated FPC version from SVN.
More information about the fpc-pascal