[fpc-pascal] xxHash

2014-08-28 Thread Vojtěch Čihák
Hi,   I ported to freepascal xxHash, very fast non-cryptographic algorithm, working near the RAM limits. Originally, it is written in C and published under the BSD license.    Original C: https://code.google.com/p/xxhash/    Pascal port: http://sourceforge.net/projects/xxhashfpc/files/    Currently

Re: [fpc-pascal] with statement using mulltiple objects

2014-09-14 Thread Vojtěch Čihák
Hi,   once I came to troubles with "with":   procedure TForm1.StringGrid1SelectEditor(Sender: TObject; aCol, aRow: Integer; var Editor: TWinControl); begin   with StringGrid1 do     begin       ...       Editor:= ...;       ...     end; end;  because Editor is also public property of TStringGrid

Re: [fpc-pascal] TDomNode to text and/or document

2014-09-22 Thread Vojtěch Čihák
Hi,   this is working code:   ... if not assigned(XMLDoc) then XMLDoc:=TXMLDocument.Create;   with XMLDoc do     begin       if not assigned(DocumentElement) then         begin           aNode:=CreateElement(cRoot);           AppendChild(aNode);          end;         if ASchemeNode='' then AScheme

[fpc-pascal] Initialization of variables used in nested methods

2015-05-13 Thread Vojtěch Čihák
Hi,   I have question about initialization of variables used in nested methods.   This code gives warning: Variable "a" does not seem to be initialized.   procedure TForm1.Demo; var a: Integer;    { procedure ProcNested;   begin     a:=1;   end; }   begin   writeln('a: ', a); end;          When I

[fpc-pascal] $B and $BOOLEVAL

2015-12-13 Thread Vojtěch Čihák
  Hi,   when I use {$B} I get " Warning: Illegal compiler directive "$B"' ". When I use $BOOLEVAL everything is OK. It does not correspond with docs: http://www.freepascal.org/docs-html/3.0.0/prog/progsu4.html   Should I report? V. ___ fpc-pascal mailli

Re: [fpc-pascal] $B and $BOOLEVAL

2015-12-13 Thread Vojtěch Čihák
ot; Komu: "FPC-Pascal users discussions" Datum: 13.12.2015 20:11 Předmět: Re: [fpc-pascal] $B and $BOOLEVAL Am 13.12.2015 um 19:17 schrieb Vojtěch Čihák:   Hi,   when I use {$B} I get " Warning: Illegal compiler directive "$B&qu

Re: [fpc-pascal] ideU version 1.0.0.

2015-12-26 Thread Vojtěch Čihák
Hello Fred, just for curiosity, your mails (on fpc-pascal) sometimes appear "Fred van Stappen" and sometimes "fredvs". Why? Do you have more accounts?   Blaazen __ Od: fredvs Komu: Datum: 26.12.2015 10:55 Předmět: Re: [fpc-pascal] ide

Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-01-31 Thread Vojtěch Čihák
Hi,   what is difference in produced assembler between ifthen(); and classic if - then - else? Thanks, V. __ Od: Sven Barth Komu: "FPC-Pascal users discussions" Datum: 31.01.2016 15:43 Předmět: [fpc-pascal] New feature: IfThen() intr

Re: [fpc-pascal] Parameter evaluation order

2016-02-02 Thread Vojtěch Čihák
It is guaranted for boolean operators with short-evaluation (if you mean this). See: http://www.freepascal.org/docs-html/ref/refsu48.html#x150-17200012.8.3   V. __ Od: Andreas Berger Komu: Datum: 02.02.2016 13:57 Předmět: Re: [fpc-pasc

Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-04 Thread Vojtěch Čihák
Hi, I personally think that there's no place for democracy in compiler development. It would lead to bloat. Although majority of people considered it useful, it was not very pascalish. Trunk is place for experiments and this one is over.   V. _

Re: [fpc-pascal] Please someone explain this to me

2016-02-09 Thread Vojtěch Čihák
There exists IDE directive {%MainUnit ***.pas} and include files should contain it. But I don't know if there are more units containing the same include file.   V. __ Od: Anthony Walter Komu: "FPC-Pascal users discussions" Datum: 10.0

Re: [fpc-pascal] Happy tickets benchmark

2016-02-13 Thread Vojtěch Čihák
Hi,   64-bit Linux, Core2Duo@2GHz, FPC3.0.0:   Pascal: 440 ms C:  163ms Delphi )*: 515ms   )* Delphi7, personal edition, under wine, command: wine happyd7.exe __ Od: Serguei TARASSOV Komu: Datum: 13.02.2016 11:44 Předmět: [fpc-pascal]

Re: [fpc-pascal] Happy tickets benchmark

2016-02-13 Thread Vojtěch Čihák
Thanks, but assembler links are wrong, all seem to point to test.c.   V. aka Blaazen   __ Od: leledumbo Komu: Datum: 13.02.2016 18:43 Předmět: Re: [fpc-pascal] Happy tickets benchmark Here's a test from my machine (Manjaro Linux x86_

Re: [fpc-pascal] Happy tickets benchmark

2016-02-13 Thread Vojtěch Čihák
I can confirm, Inc(); is slower. Change decreased time from 440 to 390 ms.   Quick test (empty project in Laz.): unit1.pas:35                              inc(TicketsCount); 0046DB18 4883c001                 add    $0x1,%rax unit1.pas:36                              TicketsCount+=1; 00

Re: [fpc-pascal] Happy tickets benchmark

2016-02-14 Thread Vojtěch Čihák
Does FPC generate different code for Intel (like Core i7) and AMD (like Phenom or so) when taget architecture is set to x86_64, i.e. are there any CPU manufacturer specific optimizations ?   Thanks for reply,   V. __ Od: Florian Klaemp

Re: [fpc-pascal] Compiler Mode?

2016-02-24 Thread Vojtěch Čihák
Assigning static class methods to procedure variables in ObjFPC would be very nice feature.   V. __ Od: Sven Barth Komu: "FPC-Pascal users discussions" Datum: 24.02.2016 17:22 Předmět: Re: [fpc-pascal] Compiler Mode? * Unlogical appr

Re: [fpc-pascal] Possible bug in Numeric test

2016-02-24 Thread Vojtěch Čihák
I tried your function in FPC 3.0.0 in mode ObjFPC and it returns False for string 'E1/E2/etc'.   V. __ Od: steveg Komu: "FPC-Pascal users discussions" Datum: 24.02.2016 00:57 Předmět: [fpc-pascal] Possible bug in Numeric test Not su

Re: [fpc-pascal] Possible bug in Numeric test

2016-02-24 Thread Vojtěch Čihák
Oh, I didn't catch it. So there must be some checking for E in the string - at least on the first place - because strings 'E' and '1E' returns FALSE.  __ Od: Nitorami Komu: Datum: 24.02.2016 22:22 Předmět: Re: [fpc-pascal] Possible bu

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Vojtěch Čihák
IMO compilers should be dogmatic otherwise one cannot rely on them. This looks to me like advocating wrong optimization.   Blaazen __ Od: silvioprog Komu: "FPC-Pascal users discussions" Datum: 31.03.2016 15:33 Předmět: [fpc-pascal] Cl

Re: [fpc-pascal] Class constructor called unconditionally

2016-03-31 Thread Vojtěch Čihák
ditionally On Thu, Mar 31, 2016 at 10:58 AM, Vojtěch Čihák > wrote: IMO compilers should be dogmatic otherwise one cannot rely on them. This looks to me like advocating wrong optimization.   Blaazen Thanks for reply Vojtěch, but are you referring to Delphi or FPC optimization?I think that F

Re: [fpc-pascal] Class vs Object type

2016-04-06 Thread Vojtěch Čihák
How can I do it?   When I try do:   TMyObj = object(TObject)   compiler tells me:   Error: The mix of different kind of objects (class, object, interface, etc) isn't allowed   Thanks   V. __ Od: Tomas Hajny Komu: "FPC-Pascal users disc

[fpc-pascal] Type helper for array

2016-06-09 Thread Vojtěch Čihák
Hello,   I've got following declaration: ... {$modeswitch typehelpers}   interface   uses   Classes, SysUtils;   type   TBuffer = array of Single;     { TBufferHelper }   TBufferHelper = type helper for TBuffer     procedure Clear;   end; ... var aBuffer: TBuffer; ... And I can do: aBuffer[3]:=5; a

Re: [fpc-pascal] Type helper for array

2016-06-10 Thread Vojtěch Čihák
@ But the question is whether he want to set the array to empty or if he wants to clear the array's contents without changing the size.   The second is right but it was not the point. "Clear" is just one example of several methods I want to encalupsate into TBuffer. I decided use the type helper

Re: [fpc-pascal] Using for-loop index variable after loop

2016-10-10 Thread Vojtěch Čihák
Hi, if you mean this:   function CategoryIndexOf(Name: String): Integer;   var     i: Integer;   begin     for i:= lstCategory.Items.Count-1 downto 0 do begin       if lstCategory.Items[i] = Name       then Break;     end;     Result := i;     if (i = lstCategory.Items.IndexOf(cActionListEditorUnk

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-21 Thread Vojtěch Čihák
I guess Graeme meant to make non-monospaced font look like monospaced in Lazarus editor which currently doesn't work (it looks very ugly).   V. __ Od: Jürgen Hestermann Komu: FPC-Pascal users discussions Datum: 21.11.2016 17:05 Předmě

Re: [fpc-pascal] Underscores in numerical literals - grouping

2016-11-22 Thread Vojtěch Čihák
To the topic:   Currently when I write the line (in Laz. editor):   const Num = 123456789;      I can hover the identifier "Num" and I see tooltip:   const Num = 123456789 /file/name.pas(x,y)   And there is no tooltip when I hover the "123456789".   Maybe this is place for improvement.   Hovering

Re: [fpc-pascal] Array as result in function.

2017-01-21 Thread Vojtěch Čihák
Hi,   that's why portaudio.pp declares types like this:   PaStream = Pointer; PPaStream = ^PaStream; PPPaStream = ^PPaStream;   V. __ Od: Sven Barth Komu: fpc-pascal@lists.freepascal.org Datum: 21.01.2017 12:29 Předmět: Re: [fpc-pascal]

Re: [fpc-pascal] KeyDown routine and Ctrl+Q

2017-02-08 Thread Vojtěch Čihák
Hi, when you press CTRL+Q you will obtain two OnKeyDown events. The first with Key=17 (it is CTRL) and the second with Key=81 (Q). Both events will have ssCtrl in Shift.   V. __ Od: Jürgen Hestermann Komu: FPC-Pascal users discussions

Re: [fpc-pascal] KeyDown routine and Ctrl+Q

2017-02-09 Thread Vojtěch Čihák
Strange. I tested in Linux+Qt and in Delphi7 (under Wine) and both have ssCtrl in Shift when I press Ctrl (i.e. Key=17).   V. __ Od: Jürgen Hestermann Komu: FPC-Pascal users discussions Datum: 09.02.2017 11:52 Předmět: Re: [fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Vojtěch Čihák
Hi,   there are different informations about *.wav, so maybe there are different impementations too. See: http://soundfile.sapp.org/doc/WaveFormat/ and https://blogs.msdn.microsoft.com/dawate/2009/06/23/intro-to-audio-programming-part-2-demystifying-the-wav-format/   The first says that 8-bit is

Re: [fpc-pascal] Fixed record files

2017-07-09 Thread Vojtěch Čihák
Hi,   "packed record" is for compatibility. Its guaranteed that inner alignment and size of record will be always the same and will not change in future versions of compiler, unlike the plain "record".   https://www.freepascal.org/docs-html/ref/refsu15.html   V. _

Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Vojtěch Čihák
Hi,   wiki https://en.wikipedia.org/wiki/Julian_day says that "... Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, ..." The noon means 0,5.   V. __ Od: Dennis Komu: FPC-Pascal users discussions Datum: 0

Re: [fpc-pascal] why the 0.5 in the Unix Epoch (for UnixToDateTime function)

2017-08-01 Thread Vojtěch Čihák
Hi,   wiki https://en.wikipedia.org/wiki/Julian_day says that "... Julian day number 0 assigned to the day starting at noon on January 1, 4713 BC, ..." The noon means 0,5.   V. __ Od: Dennis Komu: FPC-Pascal users discussions Datum: 0

Re: [fpc-pascal] where's the glyph?

2017-10-11 Thread Vojtěch Čihák
Hi,   TBitBtn has property Kind, setting it to anything else than bkCustom will show the glyph (native, from widgetset).   With TSpeedButton, you are always on your own.   V. __ Od: pasc...@piments.com Komu: fpc-pascal@lists.freepascal.

Re: [fpc-pascal] Overloaded functions

2017-10-28 Thread Vojtěch Čihák
Overloading means that you have functions with the same name but different parameter (or param. list). You can have different return type for each parameter but you can never have the same parameters. V. __ Od: Darius Blaszyk Komu: FP

Re: [fpc-pascal] Problem with array of const

2017-10-28 Thread Vojtěch Čihák
Looking to docs: https://www.freepascal.org/docs-html/ref/refsu69.html I tried writeln(AnsiString(args[0].VAnsiString)); or just writeln(String(args[0].VAnsiString)); which works.   V.  __ Od: Darius Blaszyk Komu: FPC-Pascal users discu

Re: [fpc-pascal] Memory Leak's in XMLRead unit

2017-11-07 Thread Vojtěch Čihák
Hi, if I run the code it writes "Unhandled exception". I tried to add another try..except block and it's OK.    program xml_leak_test; {$mode objfpc} uses   heaptrc,   Classes,   DOM,   XMLRead; var   XMLDocument: TXMLDocument;   InvalidStream: TStringStream;   const   INVALID_XML_CONTENT = '<<>>

Re: [fpc-pascal] OT: what happened with the Lazarus mailing list?

2017-11-25 Thread Vojtěch Čihák
I can confirm. I sent one mail 21-st November to Laz. ML and the second today at ~19:30 and they are not in my mailbox.   V. __ Od: Giuliano Colla Komu: fpc-pascal@lists.freepascal.org Datum: 25.11.2017 13:35 Předmět: Re: [fpc-pascal]

Re: [fpc-pascal] Overloading IN operator

2017-12-12 Thread Vojtěch Čihák
It seems that overloading is possible but compiler does not want to accept anonymous array of strings. It works with variable or with anonymous array of integers (FPC 3.0.4).   V. __ Od: Fabio Luis Girardi Komu: FPC-Pascal users discu

Re: [fpc-pascal] Math.MinExtended value

2017-12-14 Thread Vojtěch Čihák
Hi, it seems you are right:  https://en.wikipedia.org/wiki/Extended_precision#Working_range   V. __ Od: Bart Komu: FPC-Pascal users discussions Datum: 14.12.2017 23:51 Předmět: [fpc-pascal] Math.MinExtended value Hi, I was playing a

Re: [fpc-pascal] TFloatHelper.BuildUp() question

2017-12-15 Thread Vojtěch Čihák
Hi,   it seems there is something wrong with helpers or Lazarus is fooled from directives.   When I find procedure TExtendedHelper.BuidUp() in syshelph.inc and hit Ctrl+Shift+Up, it takes me to TFLOATHELPER.BuildUp() implementation in syshelpf.inc. And when I hit Alt+Up, it takes me back to dec

Re: [fpc-pascal] Freepascal Zip with Password?

2017-12-15 Thread Vojtěch Čihák
Hi,   Double Commander allows to create zip archives with password but I don't know what lib they use.   V. __ Od: "James Richters" Komu: "'FPC-Pascal users discussions'" Datum: 12.12.2017 17:32 Předmět: [fpc-pascal] Freepascal Zip wi

[fpc-pascal] Publishing indexed property in descendant

2017-12-28 Thread Vojtěch Čihák
Hi,   is this bug?    { TCompStreamPers }   TCompStreamPers = class(TCustomControl)   private     function GetItem(AIndex: Integer): TPersItem;     procedure SetItem(AIndex: Integer; AValue: TPersItem);   protected     FItems: TFPObjectList;   public     constructor Create(AOwner: TComponent); over

Re: [fpc-pascal] Publishing indexed property in descendant

2017-12-28 Thread Vojtěch Čihák
, Vojtěch Čihák wrote: > Hi, >   > is this bug? >   >  { TCompStreamPers } >   TCompStreamPers = class(TCustomControl) >   private >     function GetItem(AIndex: Integer): TPersItem; >     procedure SetItem(AIndex: Integer; AValue: TPersItem); >   protected >    

Re: [fpc-pascal] Strange issue with TXMLConfig

2018-01-17 Thread Vojtěch Čihák
Hi, I can only say that TDOMNode from Laz2_DOM in trunk has function CompareName.   V. __ Od: Darius Blaszyk Komu: FPC-Pascal users discussions Datum: 18.01.2018 00:11 Předmět: [fpc-pascal] Strange issue with TXMLConfig All of a sud

Re: [fpc-pascal] Strange issue with TXMLConfig

2018-01-17 Thread Vojtěch Čihák
The second TDOMNode from unit DOM (fcl-xml) has that function too, in FPC 3.0.4. V. __ Od: Vojtěch Čihák Komu: FPC-Pascal users discussions Datum: 18.01.2018 00:30 Předmět: Re: [fpc-pascal] Strange issue with TXMLConfig Hi, I can

Re: [fpc-pascal] Strange issue with TXMLConfig

2018-01-18 Thread Vojtěch Čihák
Hmm, I remember there are two ways how to work with XML: Laz2_xxx and fcl-xml. My idea was that you got some wrong TDOMNode in the path. V. __ Od: Darius Blaszyk Komu: FPC-Pascal users discussions Datum: 18.01.2018 20:31 Předmět: Re:

[fpc-pascal] Advanced note: local variable "i" is assigned but never used?

2018-02-20 Thread Vojtěch Čihák
Hello,   would it be possible to do more advanced checking of this note? This code   var i: Integer; begin   i:=5; end;           gives Note: Local variable "i" is assigned but never used   var i: Integer; begin   i:=5;   writeln('i ', i); end;           is OK   var i: Integer; begin   i:=5;   writ

Re: [fpc-pascal] Advanced note: local variable "i" is assigned but never used?

2018-02-20 Thread Vojtěch Čihák
It does not seem to do anything in latest FPC and Lazarus.   V. __ Od: Juha Manninen Komu: FPC-Pascal users discussions Datum: 20.02.2018 14:34 Předmět: Re: [fpc-pascal] Advanced note: local variable "i" is assigned but Try with flag

Re: [fpc-pascal] Using Supports() I got an AV... bug?

2018-03-11 Thread Vojtěch Čihák
Hi,   Bar shoud be released by Interface, no need to call Free. V. __ Od: "Marcos Douglas B. Santos" Komu: FPC-Pascal users discussions Datum: 11.03.2018 14:23 Předmět: [fpc-pascal] Using Supports() I got an AV... bug? The code belo

Re: [fpc-pascal] Using Supports() I got an AV... bug?

2018-03-11 Thread Vojtěch Čihák
scal users discussions Datum: 11.03.2018 14:57 Předmět: Re: [fpc-pascal] Using Supports() I got an AV... bug? On Sun, Mar 11, 2018 at 10:52 AM, Vojtěch Čihák wrote: > > Hi, > > Bar shoud be released by Interface, no need to call Free. I'm sorry, but `Bar` was defined as `Bar: TB

Re: [fpc-pascal] Using Supports() I got an AV... bug?

2018-03-11 Thread Vojtěch Čihák
With this modification and -gh it is alright:   [v1@nb-msi Interface]$ ./test Bar supports... Heap dump by heaptrc unit 7 memory blocks allocated : 875/880 7 memory blocks freed     : 875/880 0 unfreed memory blocks : 0 True heap size : 360448 True free heap : 360448 [v1@nb-msi Interface]$   V. __

Re: [fpc-pascal] Using Supports() I got an AV... bug?

2018-03-11 Thread Vojtěch Čihák
fpc-pascal] Using Supports() I got an AV... bug? On Sun, Mar 11, 2018 at 11:51 AM, Vojtěch Čihák wrote: > With this modification and -gh it is alright: > Only if you declare `Bar` as `IBar` instead of `TBar`. Please, check your code again. Regards, Marcos Douglas __

Re: [fpc-pascal] Proposal for new Free Pascal logo

2018-03-31 Thread Vojtěch Čihák
Hi,   cheetahs have usually more rounded head and rounded ears. And whiskers should be curved. http://news.stlpublicradio.org/post/cheetah-populations-keep-falling-scientists-demand-better-protection#stream/0 Just my 50 cents.   V.   __

Re: [fpc-pascal] Using constants instead of comments

2018-04-18 Thread Vojtěch Čihák
Hi,   Why not define?   {$DEFINE DEBUG}   {$IFDEF DEBUG} Writeln('diagnostic info'); {$ENDIF}   V.   __ Od: "James Richters" Komu: "'FPC-Pascal users discussions'" Datum: 18.04.2018 05:06 Předmět: [fpc-pascal] Using constants instead o

Re: [fpc-pascal] Feature announcement: default namespaces

2018-05-06 Thread Vojtěch Čihák
i,   LCLIntf, LCLProc, LCLType isn't enough? I will use dotted units only if there will be absolutely no other way around. I believe it can be useful but I don't think it's "must have" (when I don't consider Delphi compat.).    V. __ O

Re: [fpc-pascal] Currency and Int64 casting

2018-05-17 Thread Vojtěch Čihák
Hi,   Linux 64-bit Lazarus 1.9.0 r57948M FPC 3.1.1 x86_64-linux-qt gives    1.00E+00 1 V.__ Od: LacaK Komu: FPC-Pascal users discussions Datum: 17.05.2018 13:33 Předmět: [fpc-pascal] Currency and Int64 casting Hi,

Re: [fpc-pascal] Currency and Int64 casting

2018-05-18 Thread Vojtěch Čihák
Hi,   I have unit1.pas:36                              i:=Int64(c); 0046EEE0 488b45e8                 mov    -0x18(%rbp),%rax 0046EEE4 488945e0                 mov    %rax,-0x20(%rbp) unit1.pas:38                              writeln(i); at Level0 andunit1.pas:36                   

Re: [fpc-pascal] TFPGObjectList error

2018-06-30 Thread Vojtěch Čihák
Hi,   this seems to be misleading error message. TFPGObjectList works well for objects (classes). When I tried to push record to it, I got the same error message. TVec3 is not class, right?   Vojtěch __ Od: Ryan Joseph Komu: FPC-Pasca

Re: [fpc-pascal] Loss of precision when using math.Max()

2018-07-03 Thread Vojtěch Čihák
Hi,   I agree with the original topic that overload function Math.Max(Double, Double) shoud be chosen instead of Math.Max(Single, Single) when one of parameters is Integer.   But your criticism make no sense to me. You can as well point that this code:   var a, b: Byte; begin   a:=5;   b:=a div

Re: [fpc-pascal] Syntax changes suggestions

2018-07-17 Thread Vojtěch Čihák
Hi,   Lazarus has option "Show Class/Proc Hint" which displays method name (with light-green background) as the top line in source editor, only if the method's body is longer than number of lines in source editor. Maybe new option "Show Proc var block" for permanent displaying var block in long

Re: [fpc-pascal] Syntax changes suggestions

2018-07-17 Thread Vojtěch Čihák
. And I guess programmers have usually bigger displays.   V.   __ Od: Michael Van Canneyt Komu: FPC-Pascal users discussions Datum: 17.07.2018 15:34 Předmět: Re: [fpc-pascal] Syntax changes suggestions On Tue, 17 Jul 2018, Vojtěch Čihák

Re: [fpc-pascal] Operator overload bug

2018-07-22 Thread Vojtěch Čihák
Hello,   you can define type:   TIntArray = array of Integer;   operator + (left: TMyClass; right: TIntArray): TMyClass; overload;   and with retyping it works:   c := c + TIntArray([1, 2, 3]);   V.     __ Od: Ben Grasset Komu: FPC-Pasc

[fpc-pascal] Generics - extending TFPGObjectList

2018-07-25 Thread Vojtěch Čihák
Hello,   I needed to extend TFPGObjectList and I found two wierd things (FPC 3.1.1 r39507):   program project1; {$mode objfpc}{$H+}   uses   Classes, FGL;   type   TBaseClass = class (TObject)   end;     TIDClass = class (TBaseClass)     ID: Integer;   end;     TNameIDClass = class (TIDClass)    

Re: [fpc-pascal] Generics - extending TFPGObjectList

2018-07-26 Thread Vojtěch Čihák
Thanks for reply.   Ad 2) I opened issue: https://bugs.freepascal.org/view.php?id=34037   Ad 1) Are there any plans for improvement of generic inheritance? Related to my example, instead of       generic TFPGObjectListEx = class (specialize TFPGObjectList)   I would prefer simplier and more strai

Re: [fpc-pascal] Will moving from due core CPU to 6 Core CPU of the same clock speed improve the speed of FPC compiling?

2018-08-06 Thread Vojtěch Čihák
And the gain will be lost after installing Spectre patches, where is measured performance loss is 1~3%.   V. __ Od: Martin Komu: fpc-pascal@lists.freepascal.org Datum: 06.08.2018 14:38 Předmět: Re: [fpc-pascal] Will moving from due cor

[fpc-pascal] SetLength warnings - request

2018-09-06 Thread Vojtěch Čihák
Hello,   even if there's closed issue https://bugs.freepascal.org/view.php?id=34169 I would like to ask if it can be reconsidered.   The subject is that SetLength now gives warning: Variable "dynamic array" of a managed type does not seem to be initialized in 3.3.1 and 3.1.1 while it doesn't giv

[fpc-pascal] SetLength warnings - request

2018-09-06 Thread Vojtěch Čihák
Hello,   even if there's closed issue https://bugs.freepascal.org/view.php?id=34169 I would like to ask if it can be reconsidered.   The subject is that SetLength now gives warning: Variable "dynamic array" of a managed type does not seem to be initialized in 3.3.1 and 3.1.1 while it doesn't giv

Re: [fpc-pascal] Uniform initialization?

2018-11-11 Thread Vojtěch Čihák
Very good.   V. __ Od: "Sven Barth via fpc-pascal" Komu: fpc-pascal@lists.freepascal.org Datum: 11.11.2018 18:22 Předmět: Re: [fpc-pascal] Uniform initialization? Am 11.11.2018 um 16:03 schrieb tobiasgie...@gmail.com: > Hello, > > Del

Re: [fpc-pascal] Uniform initialization?

2018-11-13 Thread Vojtěch Čihák
IMO 100% Delphi compatibility was important some 10 years back when Kylix was discontinued and peope wanted to port their old Delphi projects to Linux. From that time boh FPC and Lazarus are mature enough and everyone who started a new project after - let's say - 2008 had to do the decision: De

[fpc-pascal] Generic (TFPGObjectList) EInvalidCast

2018-12-11 Thread Vojtěch Čihák
Hi,   why this code gives EInvalidCast at runtime (but compiles well):w   program Project1; {$mode objfpc}{$H+}   uses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes, fgl   { you can add units after this };   {$R *.res} type   TMyClass = class     procedure Output1;  

Re: [fpc-pascal] Generic (TFPGObjectList) EInvalidCast

2018-12-11 Thread Vojtěch Čihák
I forgot: FreePascal 3.3.1 r.40507   V. __ Od: "Vojtěch Čihák" Komu: "FPC-Pascal users discussions" Datum: 11.12.2018 22:19 Předmět: [fpc-pascal] Generic (TFPGObjectList) EInvalidCast Hi,   why this code g

Re: [fpc-pascal] Generic (TFPGObjectList) EInvalidCast

2018-12-11 Thread Vojtěch Čihák
Sorry for noise, this was wrong code and even more it has nothing to do with generics. I can solve it with class helper.   V.   __ Od: "Vojtěch Čihák" Komu: "FPC-Pascal users discussions" Datum: 11.12.2018 22:19

Re: [fpc-pascal] Generic (TFPGObjectList) EInvalidCast

2018-12-11 Thread Vojtěch Čihák
1 Dec 2018 22:19:11 +0100 Vojtěch Čihák wrote: because MyClass is not TMyDescClass Mattias ___ fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <http://lists.freepascal.org/cg

[fpc-pascal] "Hello world" syscalls

2020-01-06 Thread Vojtěch Čihák via fpc-pascal
Hi,   I found this article: https://drewdevault.com/2020/01/04/Slow.html but FPC is missing, so I wrote simple:   program Project1; begin   writeln('Hello world!'); end.    $ fpc -O3 -XX Project1.pas   $ strace -C ./Project1   % time     seconds  usecs/call     calls    errors syscall -- -

Re: [fpc-pascal] TFPGList and objects

2020-05-28 Thread Vojtěch Čihák via fpc-pascal
There is TFPGObjectList for objects.   BTW, is FGL a good choice for generics? Some time ago Marco wrote here that FGL is moreless a technology demonstrator and Generics.Collection or other libraries should be used instead.   Thanks for reply   V.   __

Re: [fpc-pascal] LongInt and LongWord types

2020-07-09 Thread Vojtěch Čihák via fpc-pascal
I suspect Embarcadero that they often intently design Delphi to be not compatible with FPC. V. __ Od: "Sven Barth via fpc-pascal" Komu: fpc-pascal@lists.freepascal.org Datum: 09.07.2020 07:30 Předmět: Re: [fpc-pascal] LongInt and LongW

Re: [fpc-pascal] TFPObjectlist example

2020-09-08 Thread Vojtěch Čihák via fpc-pascal
Hi,   I used TFPObjectList only once, for visual component TECAccordion (https://wiki.lazarus.freepascal.org/Eye-Candy_Controls#TECAccordion). Each item of list is derived from TWinControl so it is possible to use it even for visual components (like TCollection).   However, in your case (record

Re: [fpc-pascal] TFPObjectlist example

2020-09-08 Thread Vojtěch Čihák via fpc-pascal
it comfortably   MyList[1].Port:='abc';   V. ______ Od: "Vojtěch Čihák via fpc-pascal" Komu: ja...@productionautomation.net, "FPC-Pascal users discussions" Datum: 08.09.2020 16:21 Předmět: Re: [fpc

Re: [fpc-pascal] TFPGMapObject duplicate errors

2020-10-01 Thread Vojtěch Čihák via fpc-pascal
I looked to code, it gives error only when map is Sorted=True.   function TFPSMap.Add(AKey: Pointer): Integer; begin   if Sorted then   begin     if Find(AKey, Result) then       case Duplicates of         dupIgnore: exit;         dupError: Error(SDuplicateItem, 0)       end;   end else     Result

Re: [fpc-pascal] Access Violation on second compile with FPC Text IDE

2020-11-12 Thread Vojtěch Čihák via fpc-pascal
Hello,   look at this bugreport. I reported it as a Lazarus issue but now it looks like FPC trunk issue.   https://bugs.freepascal.org/view.php?id=37856   Vojtech aka Blaazen __ Od: "C Western via fpc-pascal" Komu: fpc-pascal@lists.fre

Re: [fpc-pascal] Formatting Question

2021-04-03 Thread Vojtěch Čihák via fpc-pascal
Hi,   I tried this (add StrUtils to uses):   procedure TForm1.Button1Click(Sender: TObject); var i, l: Integer;     aV: Double;     aF: TFormatSettings; begin   aF.DecimalSeparator:='.';   aF.ThousandSeparator:=' ';   for i:=-2 to 10 do     begin       aV:=pi*power(10, i);       l:=length(intToStr

Re: [fpc-pascal] FPC 3.2.2 released

2021-05-27 Thread Vojtěch Čihák via fpc-pascal
Hello and thanks.   I downloaded 3.2.2 (tar), I installed it successfully. I used it to compile the latest 3.3.1 trunk, again successfully. And I used this 3.3.1 to build the Lazarus 2.1.0 trunk (65138). Also successfully.   Everything seems be OK. Vojtěch a.k.a. Blaazen

Re: [fpc-pascal] How to use XMLCfg?

2021-08-08 Thread Vojtěch Čihák via fpc-pascal
Hi,   Laz2_ are UTF8 versions and they works well. Create(nil); means that instance has no owner. (I have Lazarus 2.3.0, it is not on line 165 here).   You can try demo at ../examples/xmlstreaming/.. It works here.   V. __ Od: "Abuy

Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?

2021-08-12 Thread Vojtěch Čihák via fpc-pascal
Hi,   my numbers of Lazarus on Linux, Qt (incl. binaries and *.ppu and *.o files)   SVN: lazarus dir: 2.6 GB (4 files, 1300 dirs) .svn subdir: 1.6 GB (25000 files, 260 dirs)   GIT: lazarus dir: 1 GB (15000 files, 950 dirs) .git subdir: 150 MB (60 files, 40 dirs)   V.  

[fpc-pascal] Problem with code aligning (probably)

2022-10-19 Thread Vojtěch Čihák via fpc-pascal
Hi,   I wrote a generic class to test sorting algorithms and also benchmarking them. I have following problem:   When I change even a single line of code anywhere in that unit, even in an unrelated method, all ~40 algorithms become a little slower or a little faster. I observed it has two levels

Re: [fpc-pascal] Problem with code aligning (probably)

2022-10-19 Thread Vojtěch Čihák via fpc-pascal
oblem.   __ Od: "Vojtěch Čihák via fpc-pascal" Komu: "FPC-Pascal users discussions" Datum: 19.10.2022 15:37 Předmět: [fpc-pascal] Problem with code aligning (probably) Hi, ...   Thanks for help. __

Re: [fpc-pascal] Problem with code aligning (probably)

2022-10-19 Thread Vojtěch Čihák via fpc-pascal
solve it reversely:  -OaJUMP=1 to -OaJUMP=2.   Of course, I'd like some persistent solution.   V.   __ Od: "Vojtěch Čihák via fpc-pascal" Komu: "FPC-Pascal users discussions" Datum: 19.10.2022 17:39 Předmět: Re:

Re: [fpc-pascal] Problem with code aligning (probably)

2022-10-20 Thread Vojtěch Čihák via fpc-pascal
On 20/10/2022 00:24, Vojtěch Čihák via fpc-pascal wrote: That's not easy, unfortunately: https://www.youtube.com/watch?v=r-TLSBdHe1A <https://www.youtube.com/watch?v=r-TLSBdHe1A> Jonas ___ fpc-pascal maillist  -  fpc-pa

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Vojtěch Čihák via fpc-pascal
Hi,   I noticed this too a few years ago when I translated xxHash from C to FPC. Pushing the code to less lines improved speed so xxHash32 was as fast as in C.   do { v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4; v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4; v3 = XXH32_round(v

Re: [fpc-pascal] Program efficiency

2022-11-09 Thread Vojtěch Čihák via fpc-pascal
Sorry, it was copy-paste from github and it broke formatting   do {       v1 = XXH32_round(v1, XXH_get32bits(input)); input += 4;       v2 = XXH32_round(v2, XXH_get32bits(input)); input += 4;       v3 = XXH32_round(v3, XXH_get32bits(input)); input += 4;       v4 = XXH32_round(v4, XXH_get32bits(inp

[fpc-pascal] How to inline CompareFunc to Sort method in generic abstract class

2022-11-14 Thread Vojtěch Čihák via fpc-pascal
Hi,   I wrote a generic abstract class - a list based on dynamic array (i.e. array of T;) and this class can be specialized elsewhere with any type (records or classes). Part of the class is sorting. There are more ways how to deliver *compare function* to sorting method. I can pass it as a para

Re: [fpc-pascal] How to inline CompareFunc to Sort method in generic abstract class

2022-11-18 Thread Vojtěch Čihák via fpc-pascal
"FPC-Pascal users discussions" Datum: 18.11.2022 20:45 Předmět: Re: [fpc-pascal] How to inline CompareFunc to Sort method in generic abstract class Em seg., 14 de nov. de 2022 15:26, Vojtěch Čihák via fpc-pascal > escreveu:,What do you mean by "be inlined"? The &#

[fpc-pascal] Local Type T and generics

2022-12-31 Thread Vojtěch Čihák via fpc-pascal
Hi,   I have local type TTempItem, i.e. declared inside method of a generic class. When I write: type       TTempItem = record        Item: T;        Empty: Boolean;      end; I got: Identifier not found "T".   When I write: type      TTempItem = record        Item: TBaseGList.T;  //name of the cla

Re: [fpc-pascal] Local Type T and generics

2023-01-03 Thread Vojtěch Čihák via fpc-pascal
T and generics Am 31.12.2022 um 14:34 schrieb Vojtěch Čihák via fpc-pascal: > Is this intended? Or known bug? It's a bug. Please report with a full example. Regards, Sven ___ fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org https://

[fpc-pascal] Dynamic array question

2023-01-11 Thread Vojtěch Čihák via fpc-pascal
Hi,   is there a way how to have dynamic array "inside" another dynamic array?   program project1; {$mode objfpc}{$H+}   uses   {$IFDEF UNIX}   cthreads,   {$ENDIF}   Classes, SysUtils   { you can add units after this };   {$R *.res} type   TDynArray = array of Integer;   PTDynArray = ^TDynArray;

Re: [fpc-pascal] Dynamic array question

2023-01-12 Thread Vojtěch Čihák via fpc-pascal
der Sluis via fpc-pascal" Komu: fpc-pascal@lists.freepascal.org Datum: 12.01.2023 00:22 Předmět: Re: [fpc-pascal] Dynamic array question Vojtěch Čihák via fpc-pascal schreef op wo 11-01-2023 om 23:38 [+0100]: > is there a way how to have dynamic array "inside" another dynamic

Re: [fpc-pascal] possible bug in blockwrite

2023-03-05 Thread Vojtěch Čihák via fpc-pascal
Hi,   you can use PChar, or string+retype to PChar in blockwrite:    BlockWrite(f1, PChar(s)^, length(s));    which gives expected result. V. __ Od: "Travis Siegel via fpc-pascal" Komu: "FPC-Pascal users discussions" Datum: 05.03.2023

Re: [fpc-pascal] IRC channel for FreePascal support ?

2023-04-13 Thread Vojtěch Čihák via fpc-pascal
Hi,   I'm almost fourteen years on the forum and a few years less on mailing lists and I never had a single problem. I don't attend IRC so I can't say what's wrong there. OTOH I read Joanna's comments on the forum and they are OK (to the topic; non conflict).   V.   _