[fpc-devel] Patch for bug 3774

Thomas Schatzl tom_at_work at gmx.at
Sun Apr 3 15:45:17 CEST 2005


Hello,

Thomas Schatzl schrieb:
> Florian Klaempfl schrieb:
> 
>> Thomas Schatzl wrote:
>> What about the extended (?) pascal convention 16#ffff ?
> 
> Done. =)

And here's the patch, including an example program. I decided to send 
them anyway because some of the issues raised by myselves below were 
solved by some further investigation.

> But until asking you to have a look at it, I've some questions:
> 
> - for non-64 bit CPUs there's a fpc_val_int64_shortstr and
> fpc_val_qword_shortstr helper function in sstrings.inc in addition to
> some note indicating problems with 1.0.10.

There is actually no problem as indicated by the comment "{ high(int64) 
produces 0 in version 1.0 (JM) }" in 1.0.10 which I consider the base 
compiler for cycling.
E.g. 1.0.10 returns the correct value for high(int64).

> Are these two helper functions still needed in 1.9.x? (Since it's a
> "feature" it will possible not be added until 2.0 anyway, so I'm asking
> if I could skip these two methods?)

I prepared the "normal" val() methods to be able to handle 64 bit 
integers too - it'd work if ValSInt and ValUInt were 64 bit sized 
(speaking about fpc_Val_SInt_ShortStr, fpc_Val_UInt_ShortStr).
Drawback: then 64 bit internal calculations would be done for _every_ 
val() invocation (also on 32 bit processors).

Compiles and works fine on 1.0.10 too, but doesn't cycle due to other 
bugs when starting with 1.0.10 (cycling with 1.9.9 is ok).

I did _not_ change the 64 bit integer functions (fpc_val_int64_shortstr, 
fpc_val_qword_shortstr) at the moment, e.g. they don't support the 
Extended Pascal notation too. If that is required, I can easily do them 
too (but since the normal methods already work for 64 bit ints on 32 
bits processors...)

> - signs for non-base 10 numbers: should they be allowed or not? E.g.
> Delphi allows -0x1234, -$1234 etc. At the moment this is implemented.
> The only problem is -$80000000.... (Delphi gives -2147...)

This has been resolved and is completely normal.

Regards,
   Thomas

P.S.: Attached zip includes my test suite, maybe it can be useful too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestVal.zip
Type: application/zip
Size: 3349 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050403/442680be/attachment.zip>


More information about the fpc-devel mailing list