Free Pascal
Reference guide


______________________________________________________________________
Reference guide for Free Pascal, version 3.0.0
Document version 3.0
November 2015

Michaėl Van Canneyt

____________________________________________________________________________
Contents
List of Tables
 About this guide
  Notations
  Syntax diagrams
 About the Pascal language
1 Pascal Tokens
 1.1 Symbols
 1.2 Comments
 1.3 Reserved words
  1.3.1 Turbo Pascal reserved words
  1.3.2 Free Pascal reserved words
  1.3.3 Object Pascal reserved words
  1.3.4 Modifiers
 1.4 Identifiers
 1.5 Hint directives
 1.6 Numbers
 1.7 Labels
 1.8 Character strings
2 Constants
 2.1 Ordinary constants
 2.2 Typed constants
 2.3 Resource strings
3 Types
 3.1 Base types
  3.1.1 Ordinal types
  3.1.2 Real types
 3.2 Character types
  3.2.1 Char or AnsiChar
  3.2.2 WideChar
  3.2.3 Other character types
  3.2.4 Single-byte String types
  3.2.5 Multi-byte String types
  3.2.6 Constant strings
  3.2.7 PChar - Null terminated strings
  3.2.8 String sizes
 3.3 Structured Types
  3.3.1 Arrays
  3.3.2 Record types
  3.3.3 Set types
  3.3.4 File types
 3.4 Pointers
 3.5 Forward type declarations
 3.6 Procedural types
 3.7 Variant types
  3.7.1 Definition
  3.7.2 Variants in assignments and expressions
  3.7.3 Variants and interfaces
 3.8 Type aliases
4 Variables
 4.1 Definition
 4.2 Declaration
 4.3 Scope
 4.4 Initialized variables
 4.5 Initializing variables using default
 4.6 Thread Variables
 4.7 Properties
5 Objects
 5.1 Declaration
 5.2 Fields
 5.3 Class or Static fields
 5.4 Constructors and destructors
 5.5 Methods
  5.5.1 Declaration
  5.5.2 Method invocation
 5.6 Visibility
6 Classes
 6.1 Class definitions
 6.2 Normal and static fields
  6.2.1 Normal fields/variables
  6.2.2 Class fields/variables
 6.3 Class instantiation
 6.4 Class destruction
 6.5 Methods
  6.5.1 Declaration
  6.5.2 invocation
  6.5.3 Virtual methods
  6.5.4 Class methods
  6.5.5 Class constructors and destructors
  6.5.6 Static class methods
  6.5.7 Message methods
  6.5.8 Using inherited
 6.6 Properties
  6.6.1 Definition
  6.6.2 Indexed properties
  6.6.3 Array properties
  6.6.4 Default properties
  6.6.5 Published properties
  6.6.6 Storage information
  6.6.7 Overriding properties
 6.7 Class properties
 6.8 Nested types, constants and variables
7 Interfaces
 7.1 Definition
 7.2 Interface identification: A GUID
 7.3 Interface implementations
 7.4 Interface delegation
 7.5 Interfaces and COM
 7.6 CORBA and other Interfaces
 7.7 Reference counting
8 Generics
 8.1 Introduction
 8.2 Generic type definition
 8.3 Generic type specialization
 8.4 Generic type restrictions
 8.5 Delphi compatibility
  8.5.1 Syntax elements
  8.5.2 Record type restrictions
  8.5.3 Type overloads
  8.5.4 Name space considerations
  8.5.5 Scope considerations
 8.6 Type compatibility
 8.7 Using the default intrinsic
 8.8 A word about scope
 8.9 Operator overloading and generics
9 Extended records
 9.1 Definition
 9.2 Extended record enumerators
10 Class, Record and Type helpers
 10.1 Definition
 10.2 Restrictions on class helpers
 10.3 Restrictions on record helpers
 10.4 Considerations for (simple) type helpers
 10.5 A note on scope and lifetime for record and type helpers
 10.6 Inheritance
 10.7 Usage
11 Objective-Pascal Classes
 11.1 Introduction
 11.2 Objective-Pascal class declarations
 11.3 Formal declaration
 11.4 Allocating and de-allocating Instances
 11.5 Protocol definitions
 11.6 Categories
 11.7 Name scope and Identifiers
 11.8 Selectors
 11.9 The id type
 11.10 Enumeration in Objective-C classes
12 Expressions
 12.1 Expression syntax
 12.2 Function calls
 12.3 Set constructors
 12.4 Value typecasts
 12.5 Variable typecasts
 12.6 Unaligned typecasts
 12.7 The @ operator
 12.8 Operators
  12.8.1 Arithmetic operators
  12.8.2 Logical operators
  12.8.3 Boolean operators
  12.8.4 String operators
  12.8.5 Set operators
  12.8.6 Relational operators
  12.8.7 Class operators
13 Statements
 13.1 Simple statements
  13.1.1 Assignments
  13.1.2 Procedure statements
  13.1.3 Goto statements
 13.2 Structured statements
  13.2.1 Compound statements
  13.2.2 The Case statement
  13.2.3 The If..then..else statement
  13.2.4 The For..to/downto..do statement
  13.2.5 The For..in..do statement
  13.2.6 The Repeat..until statement
  13.2.7 The While..do statement
  13.2.8 The With statement
  13.2.9 Exception Statements
 13.3 Assembler statements
14 Using functions and procedures
 14.1 Procedure declaration
 14.2 Function declaration
 14.3 Function results
 14.4 Parameter lists
  14.4.1 Value parameters
  14.4.2 Variable parameters
  14.4.3 Out parameters
  14.4.4 Constant parameters
  14.4.5 Open array parameters
  14.4.6 Array of const
 14.5 Managed types and reference counts
 14.6 Function overloading
 14.7 Forward declared functions
 14.8 External functions
 14.9 Assembler functions
 14.10 Modifiers
  14.10.1 alias
  14.10.2 cdecl
  14.10.3 export
  14.10.4 inline
  14.10.5 interrupt
  14.10.6 iocheck
  14.10.7 local
  14.10.8 noreturn
  14.10.9 nostackframe
  14.10.10 overload
  14.10.11 pascal
  14.10.12 public
  14.10.13 register
  14.10.14 safecall
  14.10.15 saveregisters
  14.10.16 softfloat
  14.10.17 stdcall
  14.10.18 varargs
 14.11 Unsupported Turbo Pascal modifiers
15 Operator overloading
 15.1 Introduction
 15.2 Operator declarations
 15.3 Assignment operators
 15.4 Arithmetic operators
 15.5 Comparison operator
 15.6 In operator
16 Programs, units, blocks
 16.1 Programs
 16.2 Units
 16.3 Namespaces: Dotted Units
 16.4 Unit dependencies
 16.5 Blocks
 16.6 Scope
  16.6.1 Block scope
  16.6.2 Record scope
  16.6.3 Class scope
  16.6.4 Unit scope
 16.7 Libraries
17 Exceptions
 17.1 The raise statement
 17.2 The try...except statement
 17.3 The try...finally statement
 17.4 Exception handling nesting
 17.5 Exception classes
18 Using assembler
 18.1 Assembler statements
 18.2 Assembler procedures and functions
Index