│ English (en) │



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.

All systems

Language

Better support for Delphi-compatible classes

Overview : Support has been added for nested types (including other classes), class variables and class-local constants.

: Support has been added for nested types (including other classes), class variables and class-local constants. Notes : Delphi-compatible.

: Delphi-compatible. More information: class_extensions_examples lists several examples that make use of these features.

Advanced record syntax

Overview : Support has been added for advanced record syntax (as Delphi calls it) including record visibility sections, nested types and constants, record methods, static fields, properties, class constructors, class destructors and class operators.

: Support has been added for advanced record syntax (as Delphi calls it) including record visibility sections, nested types and constants, record methods, static fields, properties, class constructors, class destructors and class operators. Notes : Delphi-compatible. Record (instance) constructors are not implemented yet.

: Delphi-compatible. Record (instance) constructors are not implemented yet. More information : http://docwiki.embarcadero.com/RADStudio/en/Structured_Types#Records_.28advanced.29 http://docwiki.embarcadero.com/RADStudio/en/Operator_Overloading_(Delphi) http://svn.freepascal.org/svn/fpc/trunk/tests/test/terecs_u1.pp

:

Enumerators in records

Overview : Previous FPC versions allowed enumerator structures to be classes, objects or interfaces. Now enumerator structure can also be defined as a record (using advanced record syntax only).

: Previous FPC versions allowed structures to be classes, objects or interfaces. Now structure can also be defined as a record (using advanced record syntax only). Notes : Delphi-compatible.

: Delphi-compatible. More information : http://svn.freepascal.org/svn/fpc/trunk/tests/test/tforin25.pp

:

Support for class and record helpers

Overview : Support has been added for class and record helpers which allow you to add methods, properties and enumerators to classes and records without inheriting from them.

: Support has been added for class and record helpers which allow you to add methods, properties and enumerators to classes and records without inheriting from them. Notes : Delphi-compatible.

: Delphi-compatible. More information : Helper types contains a detailed description of the feature The tests are named thlp*.pp , tchlp*.pp and trhlp*.pp and available in http://svn.freepascal.org/svn/fpc/trunk/tests/test/

:

Generic records, arrays and procedural types

Overview : Previous FPC versions only supported generic classes, objects and interfaces. Now it is also possible to define generic records, generic arrays and generic procedural types.

: Previous FPC versions only supported generic classes, objects and interfaces. Now it is also possible to define generic records, generic arrays and generic procedural types. Notes : Generics are available both in ObjFPC and Delphi modes and generic records/arrays/procedural variables are defined similar to generic classes. Support for Delphi's generic syntax has been added but still may be not 100% compatible.

: Generics are available both in ObjFPC and Delphi modes and generic records/arrays/procedural variables are defined similar to generic classes. Support for Delphi's generic syntax has been added but still may be not 100% compatible. More information : http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric24.pp http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric25.pp http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric26.pp http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric27.pp http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric28.pp http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric32.pp http://svn.freepascal.org/svn/fpc/trunk/tests/test/tgeneric33.pp

:

Scoped enumerations

Overview : Support for the {$scopedenums on/off} directive has been added. The elements of enumerations defined as a scoped enumeration can only be used by fully qualifying them via typename.element .

: Support for the directive has been added. The elements of enumerations defined as a can only be used by fully qualifying them via . Notes : Delphi-compatible.

: Delphi-compatible. More information: http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirsscopedenums_xml.html

Custom deprecated messages

Overview : Deprecated can now be applied to virtually any syntactic element (including constants and units), and it is also possible to specify a custom deprecation message.

: can now be applied to virtually any syntactic element (including constants and units), and it is also possible to specify a custom deprecation message. Notes : Delphi-compatible

: Delphi-compatible More information:

unit OldUnit deprecated 'Use NewUnit instead' ; interface implementation procedure OldRoutine ; deprecated 'Use NewRoutine instead' ; begin end ; end .

Support for the Objective-Pascal dialect

Overview : On macOS, most system frameworks are written in Objective-C. While it is possible to interface them via a procedural API, this is not very convenient. For this reason, the Macintosh Pascal community has created a new dialect called Objective-Pascal that enables seamless interacting with Objective-C code.

: On macOS, most system frameworks are written in Objective-C. While it is possible to interface them via a procedural API, this is not very convenient. For this reason, the Macintosh Pascal community has created a new dialect called Objective-Pascal that enables seamless interacting with Objective-C code. Notes : This new dialect is currently only supported on Darwin-based platforms (including iOS) using the Apple Objective-C runtime. Patches to add support for the GNUStep runtime are welcome.

: This new dialect is currently only supported on Darwin-based platforms (including iOS) using the Apple Objective-C runtime. Patches to add support for the GNUStep runtime are welcome. More information : FPC_PasCocoa explains the basic language definitions. FPC_PasCocoa/Differences explains some of the differences between Objective-Pascal and on the one hand Object Pascal, and on the other hand Objective-C.

:

Constref parameter modifier

Overview : A new parameter modifier called constref has been added, similar to the existing var , const and out ones. This modifier means that the compiler can assume that the parameter is constant, and that it must be passed by reference. Its most obvious usage is to translate const * parameters from C headers.

: A new parameter modifier called has been added, similar to the existing , and ones. This modifier means that the compiler can assume that the parameter is constant, and that it must be passed by reference. Its most obvious usage is to translate parameters from C headers. Notes : The main reason it was introduced was to enable writing a cross-platform interface for XPCOM, as explained on the User Changes 2.6.0 page. Note that in general, it should only be used for interfacing with external code or when writing assembler routines. In other cases, letting the compiler decide how to pass the parameter is more likely to result in optimal code on most platforms in the long term.

: The main reason it was introduced was to enable writing a cross-platform interface for XPCOM, as explained on the User Changes 2.6.0 page. Note that in general, it should only be used for interfacing with external code or when writing assembler routines. In other cases, letting the compiler decide how to pass the parameter is more likely to result in optimal code on most platforms in the long term. More information:

procedure test ( constref l : longint ) ; begin writeln ( 'This parameter has been passed by reference, although the Pascal code does not really care about that: ' , l ) ; end ; begin test ( 5 ) ; end .

Basic ISO Standard Pascal support

Overview : A language mode supporting ISO 7185 Standard Pascal has been added. It can be activated via the -Miso command line switch, or via the {$mode iso} compiler directive.

: A language mode supporting ISO 7185 Standard Pascal has been added. It can be activated via the command line switch, or via the compiler directive. Notes : This support is not yet complete. In particular, no ISO Standard Pascal compatible I/O is available yet (get, put, ...)

: This support is not yet complete. In particular, no ISO Standard Pascal compatible I/O is available yet (get, put, ...) More information: http://www.moorecad.com/standardpascal/standards.html

Support for nested procedure variables

Overview : It is now possible to define procedure variables that are assignment-compatible with nested procedures and functions. This feature is enabled by default in {$mode macpas} and {$mode iso} , and can be enabled in other syntax modes by adding {$modeswitch nestedprocvars} to your source file. Note that it is possible to also assign regular (non-nested) procedures/functions to a nested procedure variable, and to call them that way.

: It is now possible to define procedure variables that are assignment-compatible with nested procedures and functions. This feature is enabled by default in and , and can be enabled in other syntax modes by adding to your source file. Note that it is possible to also assign regular (non-nested) procedures/functions to a nested procedure variable, and to call them that way. Notes : Enabling this feature changes the calling convention used for nested procedures/functions. This will break code from the Turbo Pascal era that uses nested procedures/functions as callbacks from collection iterators in the objects unit.

: Enabling this feature changes the calling convention used for nested procedures/functions. This will break code from the Turbo Pascal era that uses nested procedures/functions as callbacks from collection iterators in the unit. More information : A procedure variable type can hold a reference to nested routines in two cases: when it is declared inline in the parameter list of another function/procedure (ISO-style declaration). This form of declaring procedure variable types is only available when nestedprocvars are enabled. when it is declared as is nested, similar to of object for "procedure of object" types. Note that in this second case, it is possible to write invalid code: if you assign a nested routine to nested procedure variable and then exit the nested routine's parent stack frame, calling the nested procedure variable will result in undefined bahaviour.

: A procedure variable type can hold a reference to nested routines in two cases:

Support for non-local goto's

Overview : It is now possible to goto to a label defined in another procedure, e.g. to quickly exit from a deeply nested procedure to a less deeply nested one.

: It is now possible to to a defined in another procedure, e.g. to quickly exit from a deeply nested procedure to a less deeply nested one. Notes : Enabled by default in ISO and MacPas syntax modes, can be enabled in other modes via {$modeswitch nonlocalgoto} . It is not possible to use a non-local goto to jump over stack frames that require finalisation (e.g., when they contain reference counted types).

: Enabled by default in and syntax modes, can be enabled in other modes via . It is not possible to use a non-local goto to jump over stack frames that require finalisation (e.g., when they contain reference counted types). More information: http://svn.freepascal.org/svn/fpc/trunk/tests/test/tmacnonlocalgoto.pp

Support for &-escaping of keywords

Overview : The & sign can now be used to escape language keywords, so they can be used as identifiers.

: The & sign can now be used to escape language keywords, so they can be used as identifiers. Notes : Delphi-compatible.

: Delphi-compatible. More information: http://svn.freepascal.org/svn/fpc/trunk/tests/webtbs/tw15930.pp

Support for univ parameters in MacPas mode

Overview : Previous FPC versions simply ignored the univ qualifier for parameters. Now, FPC will properly parse it and interpret it like other Mac Pascal compilers: it allows passing any parameter whose size matches the size of the declared parameter.

: Previous FPC versions simply ignored the qualifier for parameters. Now, FPC will properly parse it and interpret it like other Mac Pascal compilers: it allows passing any parameter whose size matches the size of the declared parameter. Notes : Only enabled in {$mode macpas} . Abusing this feature can easily result in crashes or corrupted data in case the declared parameter type and the actual parameter have to be passed to the subroutine in different ways according to the calling convention. In general, this feature should only be used to port legacy code.

: Only enabled in . Abusing this feature can easily result in crashes or corrupted data in case the declared parameter type and the actual parameter have to be passed to the subroutine in different ways according to the calling convention. In general, this feature should only be used to port legacy code. More information: http://bugs.freepascal.org/view.php?id=15777

CExtended floating point type

Overview : This type is the same as the regular extended type in terms of precision, but it conforms to the properties/behaviour of the equivalent of the Extended type in C. In practice, this means that CExtended corresponds to long double on i386 and x86_64 platforms that support an 80 bits extended type, and to double on other platforms. This is mainly required for fields in records that are translated from C in order to guarantee proper field alignments, and also for parameters to C routines.

: This type is the same as the regular type in terms of precision, but it conforms to the properties/behaviour of the equivalent of the type in C. In practice, this means that corresponds to on i386 and x86_64 platforms that support an 80 bits type, and to on other platforms. This is mainly required for fields in records that are translated from C in order to guarantee proper field alignments, and also for parameters to C routines. Notes : At this time, FPC does not support an equivalent of C's long double type on platforms other than the ones mentioned above. Since Extended is an alias for Double on these other platforms in FPC, CExtended is also an alias for double there.

: At this time, FPC does not support an equivalent of C's type on platforms other than the ones mentioned above. Since is an alias for on these other platforms in FPC, is also an alias for there. More information: /

SAR intrinsics

Overview : Support has been added for shift arithmetic right (SAR) intrinsics.

: Support has been added for (SAR) intrinsics. Notes : Unlike the SHL and SHR operators, SAR is not implemented as an operator but as an intrinsic. It is also defined using different names for different integer sizes to prevent unexpected results when applying it to expressions.

: Unlike the and operators, is not implemented as an operator but as an intrinsic. It is also defined using different names for different integer sizes to prevent unexpected results when applying it to expressions. More information: http://svn.freepascal.org/svn/fpc/trunk/tests/test/cg/tsar1.pp

ROL/ROR intrinsics

Overview : Support has been added for ROL (Rotate Overflow Left) and ROR (Rotate Overflow Right) intrinsics. These shift a value left or right, inserting bits that were shifted out at the other side of the value.

: Support has been added for (Rotate Overflow Left) and (Rotate Overflow Right) intrinsics. These shift a value left or right, inserting bits that were shifted out at the other side of the value. Notes : Just like for the SAR intrinsic, separate versions have been added for different integer sizes in order to prevent any ambiguities.

: Just like for the intrinsic, separate versions have been added for different integer sizes in order to prevent any ambiguities. More information: http://svn.freepascal.org/svn/fpc/trunk/tests/test/trox1.pp

Bitscan intrinsics

Overview : Support has been added for BSF (Bit Scan Forward) and BSR (Bit Scan Reverse) intrinsics.

: Support has been added for (Bit Scan Forward) and (Bit Scan Reverse) intrinsics. Notes : Just like for the SAR intrinsic, separate versions have been added for different integer sizes in order to prevent any ambiguities.

: Just like for the intrinsic, separate versions have been added for different integer sizes in order to prevent any ambiguities. More information: http://svn.freepascal.org/svn/fpc/trunk/tests/test/tbsx1.pp

Boolean16, Boolean32 and Boolean64 types

Overview : Support has been added for Boolean16 , Boolean32 and Boolean64 types

: Support has been added for , and types Notes : These new Boolean types behave like the standard pascal type Boolean except that their size is 2, 4 or 8 bytes. This is useful to interface with some libraries.

: These new Boolean types behave like the standard pascal type except that their size is 2, 4 or 8 bytes. This is useful to interface with some libraries. More information: The existing WordBool, LongBool and QWordBool types assume false=0 and true<>0. With the new types false=0 and true=1, while any other value is invalid.

ARM systems

Support for VFPv2 and VFPv3

Overview : Support has been added for the ARM Vector Floating Point (VFP) units versions 2 and 3. This is the floating point unit that's usually included on, a.o., Cortex-A8 and Cortex-A9 family CPUs, and in the iOS-based devices.

: Support has been added for the ARM Vector Floating Point (VFP) units versions 2 and 3. This is the floating point unit that's usually included on, a.o., Cortex-A8 and Cortex-A9 family CPUs, and in the iOS-based devices. Notes : When targeting a CPU that implements the ARMv6 or later architecture, you must also use -Cparmv6 at the same time. The reason is that saving/restoring the VFP unit's context must occur using different instructions prior to ARMv6. -Cparmv6 is enabled by default for iOS targets though, because all such devices are at least ARMv6. Additionally, FPC only supports the so-called softfp ABI for VFP: the VFP unit is used to perform the calculations, but the used calling convention to pass floating point values is the same as for soft-float.

: When targeting a CPU that implements the ARMv6 or later architecture, you also use at the same time. The reason is that saving/restoring the VFP unit's context must occur using different instructions prior to ARMv6. is enabled by default for iOS targets though, because all such devices are at least ARMv6. Additionally, FPC only supports the so-called ABI for VFP: the VFP unit is used to perform the calculations, but the used calling convention to pass floating point values is the same as for soft-float. More information: Activate using the -Cfvfpv2 resp. -Cfvfpv3 command line parameters.

Support for Thumb-2

Overview : Support has been added to generate Thumb-2 code for the ARMv7-M architecture as implemented in the Cortex-M3 family.

: Support has been added to generate Thumb-2 code for the ARMv7-M architecture as implemented in the Cortex-M3 family. Notes : This architecture is currently only supported for no-OS targets (embedded); it does not yet work for iOS or Linux.

: This architecture is currently only supported for no-OS targets (embedded); it does not yet work for iOS or Linux. More information: Activate using the -Cparmv7m or -Cpcortexm3 command line parameters.

IA32/i386 systems

Support for the iPhoneSim target

Overview : As of Xcode 3.2.4, the iPhoneSimulator target uses a different Objective-C ABI than regular i386 code. Therefore a new target called iphonesim was added to the compiler.

: As of Xcode 3.2.4, the iPhoneSimulator target uses a different Objective-C ABI than regular i386 code. Therefore a new target called was added to the compiler. Notes : If you are still using an earlier version of Xcode to develop iPhoneSimulator-based code, use the regular Darwin/i386 target.

: If you are still using an earlier version of Xcode to develop iPhoneSimulator-based code, use the regular Darwin/i386 target. More information: use the -Tiphonesim command line parameter to select this target. When compiling the FPC packages for this target, this will also compile a special version of MacOSAll that only contains APIs available for this target.