Sign in Join
Wiki copytemporary

Reserved words: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11The keywords of the individual [compiler modes](/wiki-category/Modes) are summarized as follows:
22
33- [[Mode TP|Turbo Pascal mode]]: the [[Turbo Pascal]] keywords are available for you to use
44- [[Mode Delphi|Delphi mode]]: the Turbo Pascal and Object Pascal keywords are available for you to use
55- [[Mode ObjFPC|Extended Free Pascal mode]]: the Turbo Pascal and Object Pascal keywords are available for you to use
66
77Keywords are **reserved** words, ie they cannot be defined as [[Identifier|identifiers]] by the programmer. This means that you cannot use these words to name your variables, constants, function and procedure names, class names, etc. In Pascal, in the source code, keywords are often shown in bold.
88
99## Reserved words in Turbo Pascal
1010
1111The following keywords occur in Turbo Pascal mode:
1212
1313| Keyword | Description |
1414|----|----|
1515| [[And|and]] | Boolean operator requiring both conditions are true for the result to be true |
1616| [[Array|array]] | multiple elements with the same name |
1717| [[Asm|asm]] | start of code written in assembly language |
1818| [[Begin|begin]] | start of a [[Block|block]] of code |
1919| [[Break|break]] | exit a loop |
2020| [[Case|case]] | select a particular segement of code to execute based on a value |
2121| [[Const|const]] | declare an identifier with a fixed value, or a variable with an initialized value |
2222| [[Constructor|constructor]] | routine used to create an object |
2323| [[Continue|continue]] | skips an iteration in a loop and restart execution at the beginning of the loop |
2424| [[Destructor|destructor]] | routine used to deallocate an object |
2525| [[Div|div]] | integer divide operator |
2626| [[Do|do]] | used to indicate start of a loop |
2727| [[Downto|downto]] | used in a [[For|for]] loop to indicate the index variable is decremented |
2828| [[Else|else]] | used in [[If|if]] statement to provide an execution path when the if test fails |
2929| [[End|end]] | end of a block of code, a record or certain other constructs |
3030| [[False|false]] | boolean value indicating a test failed; opposite of [[True|true]]. **As of FPC 3.0.0. False is no longer a keyword**. |
3131| [[File|file]] | external data structure, typically stored on disc |
3232| [[For|for]] | loop used to increment or decrement a control variable |
3333| [[Function|function]] | define start of a routine that returns a result value |
3434| [[Goto|goto]] | used to exit a segment of code and jump to another point |
3535| [[If|if]] | test a condition and perform a set of instructions based on the result |
3636| [[Implementation|implementation]] | define the internal routines in [[Unit|unit]] |
3737| [[In|in]] | identifies elements in a collection |
3838| [[Inline|inline]] | machine code inserted directly into a routine |
3939| [[Interface|interface]] | public declarations of routines in a [[Unit|unit]] |
4040| [[Label|label]] | defines the target jump point for a [[Goto|goto]] |
4141| [[Mod|mod]] | operator used to return the remainder of an integer division |
4242| [[Nil|nil]] | pointer value indicating the pointer does not contain a value |
4343| [[Not|not]] | boolean operator that negates the result of a test |
4444| [[Object|object]] | defines an object construct |
4545| [[Of|of]] | defines the characteristics of a variable |
4646| [[On|on]] | defines an exception handling statement in the [[Except]] part of a [[Try]] statement |
4747| [[Operator|operator]] | defines a routine used to implement an operator |
4848| [[Or|or]] | boolean operator which allows either of two choices to be used |
4949| [[Packed|packed]] | indicates the elements of an array are to use less space (this keyword is primarily for compatibility with older programs as packing of array elements is generally automatic) |
5050| [[Procedure|procedure]] | define start of a routine that does not return a result value |
5151| [[Program|program]] | defines start of an application. This keyword is usually optional. |
5252| [[Record|record]] | group a series of variables under a single name |
5353| [[Repeat|repeat]] | loop through a section of code through an [[Until|until]] statement as long as the result of the test is true |
5454| [[Set|set]] | group a collection |
5555| [[Shl|shl]] | operator to shift a value to the left; equivalent to multiplying by a power of 2 |
5656| [[Shr|shr]] | operator to shift a value to the right; equivalent to dividing by a power of 2 |
5757| [[String|string]] | declares a variable that contains multiple characters |
5858| [[Then|then]] | indicates start of code in an [[If|if]] test |
5959| [[To|to]] | indicates a [[For|for]] variable is to be incremented |
6060| [[True|true]] | boolean value indicating a test succeeded; opposite of [[False]]. **As of FPC 3.0.0. True is no longer a keyword**. |
6161| [[Type|type]] | declares kinds of records or new classes of variables |
6262| [[Unit|unit]] | separately compiled module |
6363| [[Until|until]] | indicates end test of a [[Repeat|repeat]] statement |
6464| [[Uses|uses]] | names [[Unit|units]] this program or unit refers to |
6565| [[Var|var]] | declare variables |
6666| [[While|while]] | test a value and if true, loop through a section of code |
6767| [[With|with]] | reference the internal variables within a record without having to refer to the record itself |
6868| [[Xor|xor]] | boolean operator used to invert and [[Or|or]] test |
6969
7070## Reserved words in Object Pascal
7171
7272Object 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).
7373
7474In addition to the reserved words in Turbo Pascal, the following reserved words are available in Delphi mode as well:
7575
7676| Keyword | Description |
7777|----|----|
7878| [[As|as]] | performs a conditional typecast |
7979| [[Class|class]] | a highly structured data type in Object Pascal dialects such as Delphi or the ObjFPC |
8080| [[Constref|constref]] | |
8181| [[Dispose|dispose]] | releases the memory allocated for a pointer variable allocated using new |
8282| [[Except|except]] | only used in conjunction with try |
8383| [[Exit|exit]] | immediately leaves the surrounding block |
8484| [[Exports|exports]] | exports symbols which will be publicly available |
8585| [[Finalization|finalization]] | introduces an optional 'finalization' part of a unit |
8686| [[Finally|finally]] | part of a try - finally - end block |
8787| [[Inherited|inherited]] | calls function/procedure from ancestor class |
8888| [[Initialization|initialization]] | introduces an optional 'initialization' part of a unit |
8989| [[Is|is]] | can be used as an [[Operator|operator]] or a [[modifier]] |
9090| [[Library|library]] | used in a shared library unit instead of the reserved word [[Unit|unit]] |
9191| [[New|new]] | creates a new dynamic variable and sets a pointer variable to point to it |
9292| [[On|on]] | checks against one of a number of exception classes |
9393| [[Out|out]] | |
9494| [[Property|property]] | allow various levels (read, read/write etc) outside access to variables inside a class |
9595| [[Raise|raise]] | causes an exception |
9696| [[Self|self]] | reference to an instance of a class |
9797| [[Threadvar|threadvar]] | declare global variable to be thread local |
9898| [[Try|try]] | part of Try .. Finally or Try .. Exception block |
9999
100100## Reserved words in Extended Free Pascal
101101
102102The reserved words in [[Mode ObjFPC|Extended Free Pascal mode]] include:
103103
104104- [[Mode TP|Turbo Pascal mode]] reserved words
105105- [[Mode Delphi|Object Pascal mode]] reserved words\
106106
107107## Modifiers (directives)
108108
109109Modifiers are not strictly reserved words; however they are used in the same way as reserved words.
110110
111111See the [Free Pascal Reference Guide](https://www.freepascal.org/docs-html/current/ref/ref.html) for details.
112112
113113| Modifiers | Description |
114114|----|----|
115115| [[Absolute|absolute]] | |
116116| [[abstract]] | an abstract class cannot be instantiated, only inherited |
117117| [[alias]] | |
118118| [[assembler]] | pure assembler routine: routine is defined by [[Asm|asm]] … [[End|end]] |
119119| [[cdecl]] | C declaration modifier |
120120| [[Cppdecl]] | C++ declaration modifier |
121121| [[default]] | For indexed properties to use them without specifying the property name |
122122| [[export]] | |
123123| [[external]] | |
124124| [[Forward|forward]] | Allow a subroutine to be used before it is declared |
125125| [[generic]] | class creation modifier |
126126| [[index]] | |
127127| [[Local|local]] | A function/procedure modifier only usable with Linux (for Kylix compatibility) |
128128| [[name]] | |
129129| [[nostackframe]] | compiler hint: omit stack frame if possible |
130130| [[oldfpccall]] | *deprecated* subroutine calling convention |
131131| [[Override|override]] | overriding of virtual functions |
132132| [[pascal]] | use classic pascal calling convention |
133133| [[Private|private]] | private accessibility modifier, only class members can access data/functions/procedures |
134134| [[Protected|protected]] | protected accessibility modifier, accessibility modifier, class members and inherited classes can access data/functions/procedures |
135135| [[Public|public]] | public accessibility modifier, public access to data/functions/procedures |
136136| [[Published|published]] | accessibility modifier, published properties are visible in IDE ar can be written to .lfm |
137137| [[Read|read]] | property read access |
138-| [[Register|register]] | define routine’s calling convention: pass first n parameters via <abbr title="general purpose register">GPR</abbr>s |
138+| [[Register|register]] | define routine’s calling convention: pass first n parameters via GPRs |
139139| [[Reintroduce|reintroduce]] | |
140140| [[Safecall|safecall]] | subroutine calling convention |
141141| [[softfloat]] | |
142142| [[specialize]] | specialization of [[Generics|generic classes]] |
143143| [[Stdcall|stdcall]] | subroutine calling convention |
144144| [[Virtual|virtual]] | describes a virtual method in OO programming |
145145| [[Write|write]] | property write access |
146146| | |
147147
148148## Unsupported Turbo Pascal modifiers
149149
150150> **Note:** These modifiers **are supported** in the [[DOS]] cross compiler present in the FPC development version
151151
152152The reason why these modifiers are not supported is that these modifiers deal with 16 bit code for DOS. In other words, these modifiers have special meaning for 16 bit programming under DOS and Windows 3.x.
153153
154154As Free Pascal does not support 16 bit code (only 32 and 64 bit), these modifiers are irrelevant in Free Pascal code.
155155
156156| | |
157157|----|----|
158158| [[Far|far]] | access addresses outside of the current 64KB segment |
159159| [[Near|near]] | access addresses in the current 64KB segment |
160160
161161## More functionality
162162
163163Apart 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:
164164
165165- [[RTL]]: Run-Time Library, available for all FPC and Lazarus programs
166166- [[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)
167167- FPC Packages: other packages provided by FPC
168168- Lazarus components: these are Lazarus components that can be dropped on a form and often based on FCL or FPC packages
169169- Lazarus utility functions: e.g. the [fileutil](http://wiki.lazarus.freepascal.org/Category:fileutil) unit.
170170
171171Apart from the libraries provided by FPC and Lazarus, there are more libraries/components available:
172172
173173- FPC user-supplied units: see the FPC wiki
174174- Lazarus CCR: components
175175- User-supplied code on the internet: see open source repositories like SourceForge and GitHub.
176176
177177## See also
178178
179179- [[Pascal basics]]
180180
181181---
182182*From the Free Pascal wiki, page "Reserved words", as it stood on 2024-05-19 after a change by Kberov, 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](/wiki-contact).*

Back to history