RAD Studio
ContentsIndex
PreviousUpNext
Constants Overview

This section contains Constant topics.

Name 
Description 
This section contains Character Constant topics. 
Constants are tokens representing fixed numeric or character values.
The compiler supports four classes of constants: integer, floating point, character (including strings), and enumeration.
Internal representation of numerical types shows how these types are represented internally.
The data type of a constant is deduced by the compiler using such clues as numeric value and the format used in the source code. The formal definition of a constant is shown in the following table.
Constants: Formal Definitions  

Decimal constants  
This section contains Constant Expression topics. 
This section contains Constants and Internal Representation topics. 
A floating-point constant consists of:
  • Decimal integer
  • Decimal point
  • Decimal fraction
  • e or E and a signed integer exponent (optional)
  • Type suffix: f or F or l or L (optional)
You can omit either the decimal integer or the decimal fraction (but not both). You can omit either the decimal point or the letter e (or E) and the signed integer exponent (but not both). These rules allow for conventional and scientific (exponent) notations.
Negative floating constants are taken as positive constants with the unary operator minus (-) prefixed.
Here are some examples:  
This section contains Enumeration Constant topics. 
Integer constants can be decimal (base 10), octal (base 8) or hexadecimal (base 16). In the absence of any overriding suffixes, the data type of an integer constant is derived from its value, as shown in Integer constants without L or U.. Note that the rules vary between decimal and nondecimal constants.
Decimal
Decimal constants from 0 to 4,294,967,295 are allowed. Constants exceeding this limit are truncated. Decimal constants must not use an initial zero. An integer constant that has an initial zero is interpreted as an octal constant. Thus,  
This section contains Internal Representation of Numerical Type topics. 
This section contains String Constant topics. 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!