[fpc-pascal] Specializing generics in a generic

2007-12-26 Thread bartek
Hi,

When i try to specialize generics in a generic, FPC wants me to give more types 
for specialization (of the containing generic) where IMO only one is needed.

The code:

{$mode objfpc} {$h+}
program test;
uses classes, sysutils;

type
generic TNode = class
var
public
Data: T;
constructor Create;
destructor Destroy; override;
end;

generic TContainer = class
public
type
TTNode = specialize TNode;
TTNodeNode = specialize TNode;
TTNodeNodeRec = record
ANode: TTNodeNode;
end;
TTNodeNodeRecNode = specialize TNode;
var
public
Data: TTNodeNodeRecNode;
constructor Create;
destructor Destroy; override;
end;

TAContainer = specialize TContainer;
--^ (30, 51)
constructor TNode.Create;
begin
end;

destructor TNode.Destroy;
begin
inherited Destroy;
end;

constructor TContainer.Create;
begin
end;

destructor TContainer.Destroy;
begin
inherited Destroy;
end;

var
AContainer: TAContainer;
begin
end.

[1049] [EMAIL PROTECTED]:~/Dev/Tests
% fpc test.pp
Free Pascal Compiler version 2.3.1 [2007/12/27] for i386
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for i386
Compiling test.pp
test.pp(30,51) Fatal: Syntax error, "," expected but ">" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not 
specify a source file to be compiled)

Never having written any generic code i am not sure whether there is a problem 
in my code or in fpc. I hope somebody can enlighten me once again ;)
Thank you in advance.

bartek.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] getlastoserror giving wrong value?

2007-12-26 Thread Marc Santhoff
Am Freitag, den 21.12.2007, 06:37 +0100 schrieb Marc Santhoff:
> How can that happen?

Pretty simple, all occurences of getlastoserror() and the error variable
seem to declare the number as longint. In my program I did the same. The
value given back is only a word - or looks as if it is.

When looking at the hex form of the error number in question things are
getting clear:

longint -65523 = hex 000D

So somewhere the upper word is lost or set to , when omitting this
part by using word as variable type anything is okay.

I'll try to find out if this is something special coming from the OS or
if it's a compiler issue.

[FreeBSD 4.11, fpc 2.0.4]

Marc


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal