Re: [fpc-devel] Problems building on i386-win32

2020-11-26 Thread Virgo Pärna via fpc-devel
On Wed, 25 Nov 2020 08:51:19 +, J. Gareth Moreton via fpc-devel 
 wrote:
> Aah, typical!  C:\Windows\System32 is supposed to be for 32-bit DLLs, 
> while C:\Windows\System is 64-bit.  Question is, what can I do to 
> resolve it?  I'm not even sure what Common.dll is for.

 SYSTEM32 has 64 bit files on 64 bit Windowsi, 32 bit files go to
 SysWOW64. I'm not sure, what SYSTEM was for. And Windows Virtualises
 access to SYSTEM32 to SysWOW64 for 32 bit programs. I specifically
 tested with 32 and 64 bit Total Commander - they show different content
 for C:\WINDOWS\SYSTEM32 directory.
So if the compiler is 32 bit fpc, then actual dll should be
C:\Windows\SysWOW64. And if that is 64 bit dll for some reason, then
that could cause problems. 

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Currency * Double

2021-10-23 Thread Virgo Pärna via fpc-devel
On Fri, 22 Oct 2021 08:42:57 +0200, LacaK via fpc-devel 
 wrote:
> Hi ,
> what data type is result of multiplication of: (Currency * Double) on 
> Win64 (and on Win32)?
>    c:=1115;
>    d:=1;
>    writeln(Round(c*d)); // gives -72967440737

32 bit version gives always 1115 as a result (and
floating point math should always have extended precision intermeiate
there) . But even with double intermediate result on 64 bit versions 
there should not be any problems. 1.1150E+011 is well in 
range of that type.


-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] overloaded functions - order of resolving ?

2022-03-19 Thread Virgo Pärna via fpc-devel
On Thu, 17 Mar 2022 15:24:19 +0100, Martin Frb via fpc-devel 
 wrote:
> var  aByte: byte;  aWord: word;  aString: string;
> begin
>    Foo(11, 1); // byte
>    Foo(21, aByte);  // byte
>    Foo(22, aWord);  // byte

What are the values of aByte and aWord?
I would suggest testing with aWord value greater then 255.  

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] overloaded functions - order of resolving ?

2022-03-21 Thread Virgo Pärna via fpc-devel
On Fri, 18 Mar 2022 12:43:49 - (UTC), Virgo Pärna via fpc-devel 
 wrote:
>
>   What are the values of aByte and aWord?
>   I would suggest testing with aWord value greater then 255.  
>

Did some testing myself. With fpc 3.2.0 with -O- byte version is
still used, if actual aWord value is greater, then maximum byte value. 
And that is even then, when I modified Foo to actually use P2
(added len parameter to both versions). So it cannot be any
optimization, that P2 is not used. So, it looks like a compiler bug. 

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Concatenating huge AnsiStrings

2024-06-27 Thread Virgo Pärna via fpc-devel
On Fri, 21 Jun 2024 20:03:56 +0200, Marco van de Voort via fpc-devel 
 wrote:
> Probably terminate with a heap out of memory error.

Also depends of platform...

program tests;
var
  s, s1, s2: ansistring;
begin
  SetLength(s1, High(int32));
  SetLength(s2, High(int32));
  WriteLn(Length(s1));
  WriteLn(Length(s2));
  s := s1 + s2;
  WriteLn(Length(s));
end.

Works as 64 bit Windows program:
2147483647
2147483647
4294967294

But gets "Runtime error 203 at $00404A01" on 32 bit Windows (out of
memory).

I did not actually know, that string length was 64 bits on 64 bit
platform (at least on Windows), because even uint worked. uint32 version
of same code generated warning at compile time. And uint32 version of
same code results in strings with length 0. Because sizeint is signed.

I do not have access to 64 bit Delphi, but Embarcadero RAD Studio Athena
documentation claims, that there ansistring length is limitud to "~2^31
characters". And there is no implication, that 64 bit has different
maximum.

-- 
Virgo Pärna 
virgo.pa...@mail.ee

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel