thanks so much Sven ,
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
thanks
in objfpc mode i can imagine this ,but it didn't work unless i specialize (obj)
type
generic obj = object
x : T;
end;
operator + (arg1 ,arg2 : obj):obj; // error : here (obj) needs specialization
begin
result.x := arg1.x + arg2.x;
end;
_
Hi
what is the equivalence of this code using mode objfpc ?
btw , it compile fine with {$mode delphi}
type
obj = object
x : T;
class operator add (arg1 ,arg2 : obj):obj; inline;
end;
class operator obj.add (arg1 ,arg2 : obj):obj;
begin
> mind sharing the C code?
int c ;
int test( int p){
int i;
i = p;
return (i+2+c+2+c+2+c);
}
int main(){
c = test(128);
}
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
i mean even if you initilize c with a const value.
i enabled {$optimization constprop} but nothing changed !
2015-02-03 11:19 UTC+01:00, misu kun :
> thanks ,
> even if you remove c and call test() inside writeln for example,
> still the s
thanks ,
even if you remove c and call test() inside writeln for example,
still the same thing .
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Hi
in this program test function has a known return value , and should be
calculated in compile time , but fpc make it in real time !!!
-
program test;
var c : int32;
function test( p: int32): int32; inline;
var i : int32;
begin
i := p;
test := i+2+c+2+c+2+c;
end;
begin
c: