I also have some suggestions for FPC users here...
1. FPC is very slow on I/O operation. That's why in some cases, pascal solutions got TLE. Actually it's not about language issues. Because basically FPC and gcc is very close on compiled code speed. The slowness is becaused FPC only allocates 256 bytes for I/O buffer. Compare it to gcc which allocates 4 KB for I/O buffer. Because of this, obviously, C's I/O will be faster by a large factor. To overcome this buffer limit, we need to override the default FPC buffer allocation. Here's the example:
Code: Select all
program Test;
const
MaxBuf = 4 * 1024;
var
I: Integer;
BufRead, BufWrite: array[0..MaxBuf-1] of Char;
begin
SetTextBuf(Input, BufRead, MaxBuf);
SetTextBuf(Output, BufWrite, MaxBuf);
repeat
Readln(I);
if I = 0 then Break;
Writeln(I);
until False;
Flush(Output);
end.
2. About editor or IDE for FPC. Though FPC provides text-based IDE that looks like Turbo Pascal 7 IDE, but for some people, especially Delphi people, that default text-IDE is not good enough. Delphians demand GUI IDE with great editor and easy debugging feature. Actually, there's a Delphi-like IDE for FPC. It's called Lazarus (http://www.lazarus.freepascal.org) that now become de-facto FPC IDE, both for GUI and console programming. As like FPC, Lazarus is also available natively on most platforms that supported by FPC (win32, linux, bsd, mac-os, etc running upon win32 widget, gtk1, gtk2, qt, carbon, etc). Lazarus is almost like Delphi, most Delphi features are also available in Lazarus. So, it's time to "write once, compile everywhere" using FPC and Lazarus.
Here's the screenshot Lazarus running on MacOS X...
For more information about FreePascal and Lazarus, please visit...
- FreePascal at http://www.freepascal.org
- Lazarus at http://www.lazarus.freepascal.org
And I also have a question... why FPC and pascal is no longer allowed in world final contest? Are there any technical reasons for this decision? Because I don't think it's fair since pascal as language is still very popular on many countries.