please upgrade FPC

Write here if you have problems with your Pascal source code

Moderator: Board moderators

Post Reply
bisma
New poster
Posts: 5
Joined: Tue Jun 13, 2006 6:30 am

please upgrade FPC

Post by bisma »

I found that ACM uses FreePascal (FPC) v.2.0.0 as the pascal compiler. Since now FPC has upgrade to v.2.0.2 which contains tons of bugs fixed, I recommend ACM to upgrade FPC as well.

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.
With this "optimization", your pascal program will perform about 4-5 times faster on I/O operation.

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...

Image

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.
Wirth's Knight
New poster
Posts: 1
Joined: Tue Oct 30, 2007 1:43 am

Please Upgrade to FPC 2.2.0

Post by Wirth's Knight »

Please upgrade to FPC 2.2.0
This is a major release that should not be overlooked.
Post Reply

Return to “Pascal”