FPC New Features Trunk - Lazarus wiki (original) (raw)

About this page

Below you can find a list of new features introduced since the previous release, along with some background information and examples. Note that since svn trunk is by definition still under development, some of the features here may still change before they end up in a release version.

A list of changes that may break existing code can be found here.

All systems

Compiler

fpcres can compile RC files

Language

Support for "volatile" intrinsic

Support for "noinline" modifier

Support for multiple active helpers per type

Support for custom attributes

program tcustomattr;

{$mode objfpc}{$H+} {$modeswitch prefixedattributes}

type TMyAttribute = class(TCustomAttribute) constructor Create; constructor Create(aArg: String); constructor Create(aArg: TGUID); constructor Create(aArg: LongInt); end;

{$M+} [TMyAttribute] TTestClass = class private fTest: LongInt; published [TMyAttribute('Test')] property Test: LongInt read fTest; end; {$M-}

[TMyAttribute(1234)] [TMy('Hello World')] TTestEnum = ( teOne, teTwo );

[TMyAttribute(IInterface), TMy(42)] TLongInt = type LongInt;

constructor TMyAttribute.Create; begin end;

constructor TMyAttribute.Create(aArg: String); begin end;

constructor TMyAttribute.Create(aArg: LongInt); begin end;

constructor TMyAttribute.Create(aArg: TGUID); begin end;

begin

end.

Support for constant parameters in generics

Support for "IsConstValue" intrinsic

Copy supports Open Array parameters

procedure Test(aArg: array of LongInt); var arr: array of LongInt; begin arr := Copy(aArg, 3, 5); end;

Array constructors for static arrays

"Align" modifier support for record definitions

Support for binary literals in Delphi mode

{$mode Delphi} var b: byte; begin b:=%11001001; end.

Support for Digit Separator

{$mode Delphi} var i: Integer; r: Real; begin i := %1001_1001; i := &121_102; i := 1_123_123; i := $1_123_123;
r := 1_123_123.000_000; r := 1_123_123.000_000e1_2; end.

Support for forward declarations of generic types

{$mode objfpc} type generic TTest = class; generic TFoo<T: class> = class; generic TBar = class;

TSomething = class fTest: specialize TTest; fFoo: specialize TFoo; fBar: specialize TBar<42>; end;

generic TTest = class end; generic TFoo<T: class> = class end; generic TBar = class end;

begin end.

Support for Function References and Anonymous Functions

Descendant type helpers can extend type aliases

Support for Unicode RTL

Support for Extended RTTI

Units

DaemonApp

Additional control codes on Windows

Classes

Naming of Threads

Objects

TRawByteStringCollection
TUnicodeStringCollection
TStream methods for reading and writing RawByteString and UnicodeString

FUNCTION TStream.ReadRawByteString: RawByteString; FUNCTION TStream.ReadUnicodeString: UnicodeString; PROCEDURE TStream.WriteRawByteString (Const S: RawByteString); PROCEDURE TStream.WriteUnicodeString (Const S: UnicodeString);

RawByteStrings are written to the stream as a 16-bit code page, followed by 32-bit length, followed by the string contents. UnicodeStrings are written as a 32-bit length (the number of 16-bit UTF-16 code units needed to encode the string), followed by the string itself in UTF-16.

Free Vision

Unicode support

Video

Unicode output support

Keyboard

Unicode keyboard input support

TEnhancedKeyEvent = record VirtualKeyCode: Word; { device-independent identifier of the key } VirtualScanCode: Word; { device-dependent value, generated by the keyboard } UnicodeChar: WideChar; { the translated Unicode character } AsciiChar: Char; { the translated ASCII character } ShiftState: TEnhancedShiftState; Flags: Byte; end;

TEnhancedShiftState is a set of TEnhancedShiftStateElement, which is defined as:

TEnhancedShiftStateElement = ( essShift, { either Left or Right Shift is pressed } essLeftShift, essRightShift, essCtrl, { either Left or Right Ctrl is pressed } essLeftCtrl, essRightCtrl, essAlt, { either Left or Right Alt is pressed, but not AltGr } essLeftAlt, essRightAlt, { only on keyboard layouts, without AltGr } essAltGr, { only on keyboard layouts, with AltGr instead of Right Alt } essCapsLockPressed, essCapsLockOn, essNumLockPressed, essNumLockOn, essScrollLockPressed, essScrollLockOn );

A special value NilEnhancedKeyEvent is used to indicate no key event available in the result of PollEnhancedKeyEvent:

{ The Nil value for the enhanced key event } NilEnhancedKeyEvent: TEnhancedKeyEvent = ( VirtualKeyCode: 0; VirtualScanCode: 0; UnicodeChar: #0; AsciiChar: #0; ShiftState: []; Flags: 0; );

Darwin/macOS platforms

Support for symbolicating Dwarf backtraces

New compiler targets

Support for code generation through LLVM

Support for address sanitizer (asan) through LLVM

Support for the Z80

Support for the WebAssembly target

Support for the PlayStation 1

Lazarus - Release Notes and GIT Branch with Release Fixes

Release notes for Version:

Free Pascal Compiler - User Changes (Release Notes)