Reserved words

From Free Pascal wiki
Revision as of 12:48, 1 December 2012 by BigChimp (talk | contribs) (→‎More functionality: link to fileutil. Sorry, no idea how to add a proper link to a category page, so added an external link)
Jump to navigationJump to search

Deutsch (de) English (en) français (fr) polski (pl) русский (ru) 中文(中国大陆)‎ (zh_CN)


The keywords of the individual compiler modes are summarized as follows:

  • Turbo Pascal mode: the Turbo Pascal keywords are available for you to use
  • Delphi mode: the Turbo Pascal and Object Pascal keywords are availabe for you to use
  • Free Pascal mode: the Turbo Pascal and Object Pascal keywords are available for you to use


Note: the terms keywords and reserved words are used interchangeably here is this correct? To do: insert explanation/link to the online Free Pascal manual of what a keyword/reserved word is: e.g. can you name your variables "if" etc
To do: create pages for the keywords if they don't exist yet (e.g. translate from the German version) and link to the online Free Pascal manual section on that keyword in those pages.

Reserved words in Turbo Pascal

The following keywords occur in Turbo Pascal mode:
and
array
asm
begin
break
case
const
constructor
continue
destructor
div
do
downto
else
end
false
file
for
function
goto
if
implementation
in
inline
interface
label
mod
nil
not
object
of
on
operator
or
packed
procedure
program
record
repeat
set
shl
shr
string
then
to
true
type
unit
until
uses
var
while
with
xor

Reserved words in Object Pascal

Object Pascal extends the (Turbo) Pascal language with both support for dealing more easily with objects (object orientation) as well as other newer/more advanced concepts (threads, etc).
In addition to the reserved words in Turbo Pascal, the following reserved words are available in Delphi mode as well:
as
class
dispose
except
exit
exports
finalization
finally
inherited
initialization
is
library
new
on
out
property
raise
self
threadvar
try

Reserved words in Free Pascal

The reserved words in Free Pascal mode include:

  • Turbo Pascal mode reserved words
  • Object Pascal mode reserved words


Modifiers (directives)

The list below is a list of modifiers
Modifiers are not strictly reserved words; however they are used in the same way as reserved words.
See the Free Pascal manual for details.
absolute
abstract
alias
assembler
cdecl
cppdecl
default
export
external
forward
index
local
name
nostackframe
oldfpccall
override
pascal
private
protected
public
published
read
register
reintroduce
safecall
softfloat
stdcall
virtual
write

Unsupported Turbo Pascal modifiers

The reason why these modifiers are not support is that these modifiers deal with 16 bit code
In other words, these modifiers have special meaning for 16 bit programming under DOS and Windows 3.x
As Free Pascal does not support 16 bit code (only 32 and 64 bit), these modifiers are irrelevant in Free Pascal code
far
near


More functionality

Apart from the language features provided by the reserved words/keywords mentioned above, there is a lot of functionality available for the programmer in the various libraries:

  • RTL: Run-Time Library, available for all FPC and Lazarus programs
  • FCL: Free Component Library: a core set of libraries available for Lazarus programs and usually for FPC (FPC can be compiled without it, but that only happens on purpose for low-memory embedded systems etc)
  • FPC Packages: other packages provided by FPC
  • Lazarus components: these are Lazarus components that can be dropped on a form and often based on FCL or FPC packages
  • Lazarus utility functions: e.g. the fileutil unit.

Apart from the libraries provided by FPC and Lazarus, there are more libraries/components available:

  • FPC user-supplied units: see the FPC wiki
  • Lazarus CCR: components
  • User-supplied code on the internet: see