Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

FPC New Features 3.0.0

About this page

Below you can find a list of new features introduced since the previous release, along with some background information and examples.

All systems

Language

Delphi-like namespaces units

Dynamic array constructors

New compiler intrinsic Default

pascal
type
  TRecord = record
    i: LongInt;
    s: AnsiString;
  end;

var
  i: LongInt;
  o: TObject;
  r: TRecord;
begin
  i := Default(LongInt); // 0
  o := Default(TObject); // Nil
  r := Default(TRecord); // ( i: 0; s: '')
end.
pascal
type
  generic TTest<T> = class
    procedure Test;
  end;

procedure TTest.Test;
var
  myt: T;
begin
  myt := Default(T); // will have the correct Default if class is specialized
end;

Support for type helpers

Support for codepage-aware strings

New delphiunicode syntax mode

Code generator

Class field reordering

Removing the calculation of dead values

Shortcuts to speed up floating point calculations

Constant propagation

Dead store elimination

Node dfa for liveness analysis

pascal
  var
    b : boolean;
    i : longint;
  begin
    if b then
      i:=1;
    writeln;
    if b then
      writeln(i);
  end.

In this case, the compiler warns about i being uninitialized. While some cases like the case above could be detected and the warning could be prevent, this does no apply if b is a function. To workaround this, add an assignment to i at the entry of the subroutine body.

The same applies to functions/procedures:

pascal
  var
    i : longint;
  procedure p;
    begin
      i:=1;
    end;
  begin
    p;
    writeln(i);
  end.

The current dfa approach works only intra-procedurally instead of globally, so the above case cannot yet be handled correctly. The compiler does not see that i is initialized. To work around this, add an assignment to i at the entry of the outer subroutine body.

Units and packages

TDBF support for Visual FoxPro files

Additionally, TDBf is now included in the database test suite and has received several fixes (including better Visual FoxPro codepage support).

Bufdataset supports ftAutoInc fields

TDBF, bufdataset (and descendents such as TSQLQuery) allow escaped delimiters in string expression filter

Support has been added for escaping quotes to allow this.

pascal
Filter:='(NAME=''O''''Malley''''s "Magic" Hammer'')';
//which gives
//(NAME='O''Malley''s "Magic" Hammer')
//which will match record
//O'Malley's "Magic" Hammer

TODBCConnection (odbcconn) Support for 64 bit ODBC

TZipper support for zip64 format

Multiple codepage and unicode support for most file-related RTL routines

SQL parser/generator improvements

Tools and miscellaneous

New Pas2jni utility

(Mac) OS X/iOS

New iosxlocale unit

New compiler targets

Support for the Java Virtual Machine and Dalvik targets

Support for the AIX target

Support for the 16-bit real mode MS-DOS target

Support for the Android target

Support for the armhf EABI

Support for the AROS target

New Features from other versions


From the Free Pascal wiki, page "FPC New Features 3.0.0", as it stood on 2023-05-25 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .