Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-10-30 Thread silvioprog
On Fri, Oct 31, 2014 at 12:01 AM, Kiên Nguyễn Tiến Trung wrote: > AFAIK, you must create a new type: > > type > TMyGenericInt = specialize TMyGeneric; > var > VMyGenericInt: TMyGenericInt; > > begin > VMyGenericInt:= TMyGenericInt.Create; > VMyGenericInt.Value := 2014; > VMyGe

Re: [fpc-pascal] Generic specialization using $mode objfpc

2014-10-30 Thread Kiên Nguyễn Tiến Trung
AFAIK, you must create a new type: type TMyGenericInt = specialize TMyGeneric; var VMyGenericInt: TMyGenericInt; begin VMyGenericInt:= TMyGenericInt.Create; VMyGenericInt.Value := 2014; VMyGenericInt.Free; end. 2014-10-31 2:14 GMT+07:00 silvioprog : > Hello, > > How to use t

[fpc-pascal] Generics: constructor restriction fail

2014-10-30 Thread silvioprog
Hello, Following this article: http://alex.ciobanu.org/?p=51 The compiler does not check the constructor restriction. Try this test: {$mode delphi} TTest = class private // hidding the constructor to cause a compiler error constructor Create; end; TGen = class end; constructor

Re: [fpc-pascal] Why TSdfDataSet doesn't simply return FCurRec as RecNo?

2014-10-30 Thread Michael Van Canneyt
On Thu, 30 Oct 2014, Joost van der Sluis wrote: On 10/30/2014 04:34 PM, Michael Van Canneyt wrote: On Thu, 30 Oct 2014, Michael Van Canneyt wrote: On Thu, 30 Oct 2014, Luca Olivetti wrote: Hello, TFixedFormatDataSet (ancestor of TSdfDataSet) overrides GetRecNo (correct) but it does a

Re: [fpc-pascal] Why TSdfDataSet doesn't simply return FCurRec as RecNo?

2014-10-30 Thread Joost van der Sluis
On 10/30/2014 04:34 PM, Michael Van Canneyt wrote: On Thu, 30 Oct 2014, Michael Van Canneyt wrote: On Thu, 30 Oct 2014, Luca Olivetti wrote: Hello, TFixedFormatDataSet (ancestor of TSdfDataSet) overrides GetRecNo (correct) but it does a strange contortion instead of simply returning FCur

[fpc-pascal] [OT] Generics and Type Constraints sample

2014-10-30 Thread silvioprog
Hello, I tried this example (Lazarus 1.3 r46702 FPC 2.7.1 x86_64-linux-gtk 2; FPC from trunk too): http://blogs.teamb.com/craigstuntz/2008/08/29/37832 and got the error: Compile Project, Target: project1: Exit code 256, Errors: 3 unit1.pas(27,22) Error: Identifier not found "T" unit1.pas(27,23)

[fpc-pascal] Generic specialization using $mode objfpc

2014-10-30 Thread silvioprog
Hello, How to use this code below in mode objfpc?: TMyGeneric = class(TObject) private FValue: T; public property Value: T read FValue write FValue; end; ... var VMyGenericStr: TMyGeneric; VMyGenericInt: TMyGeneric; begin VMyGenericStr := TMyGeneric.Create; VMyGenericStr

Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Jürgen Hestermann
Am 2014-10-30 um 15:21 schrieb Michael Van Canneyt: On Thu, 30 Oct 2014, Mattias Gaertner wrote: Under Linux I see UTC. But on Windows it seems to return with timezone. See this bug: http://bugs.freepascal.org/view.php?id=26963 Quite possible: like I said, it depends on the OS. The change to

Re: [fpc-pascal] Why TSdfDataSet doesn't simply return FCurRec as RecNo?

2014-10-30 Thread Michael Van Canneyt
On Thu, 30 Oct 2014, Michael Van Canneyt wrote: On Thu, 30 Oct 2014, Luca Olivetti wrote: Hello, TFixedFormatDataSet (ancestor of TSdfDataSet) overrides GetRecNo (correct) but it does a strange contortion instead of simply returning FCurRec: function TFixedFormatDataSet.GetRecNo: Longint

Re: [fpc-pascal] Why TSdfDataSet doesn't simply return FCurRec as RecNo?

2014-10-30 Thread Michael Van Canneyt
On Thu, 30 Oct 2014, Luca Olivetti wrote: Hello, TFixedFormatDataSet (ancestor of TSdfDataSet) overrides GetRecNo (correct) but it does a strange contortion instead of simply returning FCurRec: function TFixedFormatDataSet.GetRecNo: Longint; var BufPtr: TRecordBuffer; begin Result := -1;

[fpc-pascal] Why TSdfDataSet doesn't simply return FCurRec as RecNo?

2014-10-30 Thread Luca Olivetti
Hello, TFixedFormatDataSet (ancestor of TSdfDataSet) overrides GetRecNo (correct) but it does a strange contortion instead of simply returning FCurRec: function TFixedFormatDataSet.GetRecNo: Longint; var BufPtr: TRecordBuffer; begin Result := -1; if GetActiveRecBuf(BufPtr) then Result :

Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Michael Van Canneyt
On Thu, 30 Oct 2014, Mattias Gaertner wrote: On Thu, 30 Oct 2014 14:40:56 +0100 (CET) Michael Van Canneyt wrote: On Thu, 30 Oct 2014, Mattias Gaertner wrote: Hi, The docs of FileAge does not mention if timezone is used or not. http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/filea

Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Mattias Gaertner
On Thu, 30 Oct 2014 14:40:56 +0100 (CET) Michael Van Canneyt wrote: > > > On Thu, 30 Oct 2014, Mattias Gaertner wrote: > > > Hi, > > > > The docs of FileAge does not mention if timezone is used or not. > > > > http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/fileage.html > > > > Is the ret

Re: [fpc-pascal] FileAge and timezone

2014-10-30 Thread Michael Van Canneyt
On Thu, 30 Oct 2014, Mattias Gaertner wrote: Hi, The docs of FileAge does not mention if timezone is used or not. http://lazarus-ccr.sourceforge.net/docs/rtl/sysutils/fileage.html Is the returned OS time stamp with or without timezone? That depends on the OS. FileAge returns whatever the