[fpc-pascal] Re: put data to stdout (fpc vs. gcc)
fpc at xgelb.de
fpc at xgelb.de
Fri Jun 15 11:24:52 CEST 2007
Hi Jonas,
>> I know, programs with a writeln() have lower performance, but I think, printf() and writeln() must do the same. This need time to calculate.
>> But the difference between printf() and writeln() are so, that the fpc program breaks with errors.
> What kind of errors?
It will break with an error from the library, if the procedure is to slow. The fpc-writeln() works fine but to slow. The gcc-printf() works fine and fast.
Do you know a better way to produce a fast formated output in FreePascal.
I would use FreePascal and not gcc, but the fpc result is not practical.
Markus
--------------
C source:
for (i=0;i<n;i++) {
out1=(single) libout1[i];
out2=(single) libout2[i];
count+=1;
printf("%20.0f%15.5f%15.5f\n",count,out1,out2);}
--------------
fpc source:
for i:=0 to n do
begin
out1:=single(libout1[i]);
out2:=single(libout2[i]);
inc(count);
writeln(stdout, count:20, out1:15:5, out2:15:5); (* This will break! *)
end;
--------------
More information about the fpc-pascal
mailing list