Dev C%2b%2b Reserved Words

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

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

  1. Given a string, write a C/C program to reverse it. Write own reverse function by swapping characters: One simple solution is two write our own reverse function to reverse a string in C.
  2. Reserved Words or Keywords in C. These words have special meaning for C Compiler, hence they are called Keyword or Reserve Words. Each Reserve Word has its own special meaning and every Reserve Word is used only to accomplish a particular task in a particular situation. We cannot use a Reserve Word as a common identifier.
  3. There are a total of 95 reserved words in C. The reserved words of C may be conveniently placed into several groups. In the first group, we put those that were also present in the C programming language and have been carried over into C. There are 32 of these.
  • Turbo Pascal mode: the Turbo Pascal keywords are available for you to use
  • Delphi mode: the Turbo Pascal and Object Pascal keywords are available for you to use
  • Extended Free Pascal mode: the Turbo Pascal and Object Pascal keywords are available for you to use

Specific compilers may also have additional specific reserved keywords. Very important: The C language is a 'case sensitive' language. That means that an identifier written in capital letters is not equivalent to another one with the same name but written in small letters.

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:

KeywordDescription
andBoolean operator requiring both conditions are true for the result to be true
arraymultiple elements with the same name
asmstart of code written in assembly language
beginstart of a block of code
breakexit a case statement
caseselect a particular segement of code to execute based on a value
constdeclare an identifier with a fixed value, or a variable with an initialized value
constructorroutine used to create an object
continueskips an iteration in a for-loop and restart execution at the beginning of the loop
destructorroutine used to deallocate an object
divinteger divide operator
doused to indicate start of a loop
downtoused in a for loop to indicate the index variable is decremented
elseused in if statement to provide an execution path when the if test fails
endend of a block of code, a record or certain other constructs
falseboolean value indicating a test failed; opposite of true. As of FPC 3.0.0. False is no longer a keyword.
fileexternal data structure, typically stored on disc
forloop used to increment or decrement a control variable
functiondefine start of a routine that returns a result value
gotoused to exit a segment of code and jump to another point
iftest a condition and perform a set of instructions based on the result
implementationdefine the internal routines in unit
inidentifies elements in a collection
inlinemachine code inserted directly into a routine
interfacepublic declarations of routines in a unit
labeldefines the target jump point for a goto
modoperator used to return the remainder of an integer division
nilpointer value indicating the pointer does not contain a value
notboolean operator that negates the result of a test
objectdefines an object construct
ofdefines the characteristics of a variable
ondefines an exception handling statement in the Except part of a Try statement
operatordefines a routine used to implement an operator
orboolean operator which allows either of two choices to be used
packedindicates 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)
proceduredefine start of a routine that does not return a result value
programdefines start of an application. This keyword is usually optional.
recordgroup a series of variables under a single name
repeatloop through a section of code through an until statement as long as the result of the test is true
setgroup a collection
shloperator to shift a value to the left; equivalent to multiplying by a power of 2
shroperator to shift a value to the right; equivalent to dividing by a power of 2
stringdeclares a variable that contains multiple characters
thenindicates start of code in an if test
toindicates a for variable is to be incremented
trueboolean value indicating a test succeeded; opposite of False. As of FPC 3.0.0. True is no longer a keyword.
typedeclares kinds of records or new classes of variables
unitseparately compiled module
untilindicates end test of a repeat statement
usesnames units this program or unit refers to
vardeclare variables
whiletest a value and if true, loop through a section of code
withreference the internal variables within a record without having to refer to the record itself
xorboolean operator used to invert and or test

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:

KeywordDescription
as
class
constref
dispose
except
exit
exportsexports symbols which will be publicly available
finalizationintroduces an optional 'finalization' part of a unit.
finallypart of a try - finally - end block
inheritedcalls function/procedure from ancestor class
initializationintroduces an optional 'initialization' part of a unit.
iscan be used as an operator or a modifier
libraryused in a shared library unit instead of the reserved word unit
new
on
out
property
raisecauses an exception
selfreference to an instance of a class
threadvardeclare global variable to be thread local
trypart of Try . Finally or Try . Exception block

Reserved words in Extended Free Pascal

The reserved words in Extended Free Pascal mode include:

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

Modifiers (directives)

Modifiers are not strictly reserved words; however they are used in the same way as reserved words.

See the Free Pascal Reference Guide for details.

ModifiersDescription
absolute
abstractan abstract class cannot be instantiated, only inherited
alias
assemblerpure assembler routine: routine is defined by asm … end
cdeclC declaration modifier
CppdeclC++ declaration modifier
defaultFor indexed properties to use them without specifying the property name
export
external
forwardAllow a subroutine to be used before it is declared
genericclass creation modifier
index
localA function/procedure modifier only usable with Linux (for Kylix compatibility)
name
nostackframecompiler hint: omit stack frame if possible
oldfpccalldeprecated subroutine calling convention
overrideoverriding of virtual functions
pascaluse classic pascal calling convention
privateprivate accessibility modifier, only class members can access data/functions/procedures
protectedprotected accessibility modifier, accessibility modifier, class members and inherited classes can access data/functions/procedures
publicpublic accessibility modifier, public access to data/functions/procedures
publishedaccessibility modifier, published properties are visible in IDE ar can be written to .lfm
readproperty read access
registerdefine routine’s calling convention: pass first n parameters via GPRs
reintroduce
safecallsubroutine calling convention
softfloat
specializespecialization of generic classes
stdcallsubroutine calling convention
virtualdescribes a virtual method in OO programming
writeproperty write access

Unsupported Turbo Pascal modifiers

Note: These modifiers are supported in the DOS cross compiler present in the FPC development version

The 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.

As Free Pascal does not support 16 bit code (only 32 and 64 bit), these modifiers are irrelevant in Free Pascal code.

faraccess addresses outside of the current 64KB segment
nearaccess addresses in the current 64KB segment

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 open source repositories like SourceForge and GitHub.

Dev C 2b 2b Reserved Words Examples

See also

Retrieved from 'https://wiki.freepascal.org/index.php?title=Reserved_words&oldid=139712'
  • Related Questions & Answers

Dev C 2b 2b Reserved Words Unscramble

  • Selected Reading
C++ProgrammingObject Oriented Programming

Keywords are those words whose meaning is already defined by Compiler. These keywords cannot be used as an identifier. Note that keywords are the collection of reserved words and predefined identifiers. Predefined identifiers are identifiers that are defined by the compiler but can be changed in meaning by the user.

For example, you could declare a variable called main inside your main function, initialize it, and then print out its value (but ONLY do that to verify that you can!). drift streets japan download mac On the other hand, you could not do this with a variable named else. The difference is that else is a reserved word, while main is 'only' a predefined identifier.

There are a total of 95 reserved words in C++. The reserved words of C++ may be conveniently placed into several groups. In the first group, we put those that were also present in the C programming language and have been carried over into C++. There are 32 of these.

There are another 30 reserved words that were not in C, are therefore new to C++ programming language.

There are 11 C++ reserved words that are not essential when the standard ASCII character set is being used, but they have been added to provide readable alternatives for a few of the C++ operators, and also to facilitate programming with character sets that lack characters required by C++.

Here is a list of all these reserved words:

Words

Dev C 2b 2b Reserved Words Worksheets

alignas (since C++11)
double
reinterpret_cast
alignof (since C++11)
dynamic_cast
requires (since C++20)
and
else
return
and_eq
enum
short
asm
explicit
signed
atomic_cancel (TM TS)
export(1)
sizeof(1)
atomic_commit (TM TS)
extern(1)
static
atomic_noexcept (TM TS)
false
static_assert (since C++11)
auto(1)
float
static_cast
bitand
for
struct(1)
bitor
friend
switch
bool
goto
synchronized (TM TS)
break
if
template
case
import (modules TS)
this
catch
inline(1)
thread_local (since C++11)
char
int
throw
char16_t (since C++11)
long
true
char32_t (since C++11)
module (modules TS)
try
class(1)
mutable(1)
typedef
compl
namespace
typeid
concept (since C++20)
new
typename
const
noexcept (since C++11)
union
constexpr (since C++11)
not
unsigned
const_cast
not_eq
using(1)
continue
nullptr (since C++11)
virtual
co_await (coroutines TS)
operator
void
co_return (coroutines TS)
or
volatile
co_yield (coroutines TS)
or_eq
wchar_t
decltype (since C++11)
private
while
default(1)
protected
xor
delete(1)
public
xor_eq
do
register(2)