mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 02:45:58 +02:00
* Fixed Insert and Enumeration type
This commit is contained in:
parent
04c3f5099b
commit
6ceaebce25
10
docs/ref.tex
10
docs/ref.tex
@ -548,12 +548,16 @@ Type
|
|||||||
The C style enumeration type looks as follows:
|
The C style enumeration type looks as follows:
|
||||||
\begin{listing}
|
\begin{listing}
|
||||||
Type
|
Type
|
||||||
EnumType = (one, two, three, forty := 40);
|
EnumType = (one, two, three, forty := 40,fortyone);
|
||||||
\end{listing}
|
\end{listing}
|
||||||
As a result, the ordinal number of \var{forty} is \var{40}, and not \var{3},
|
As a result, the ordinal number of \var{forty} is \var{40}, and not \var{3},
|
||||||
as it would be when the \var{':= 40'} wasn't present.
|
as it would be when the \var{':= 40'} wasn't present.
|
||||||
|
The ordinal value of \var{fortyone} is then {41}, and not \var{4}, as it
|
||||||
|
would be when the assignment wasn't present. After an assignment in an
|
||||||
|
enumerated definition the compiler adds 1 to the assigned value to assign to
|
||||||
|
the next enumerated value.
|
||||||
When specifying such an enumeration type, it is important to keep in mind
|
When specifying such an enumeration type, it is important to keep in mind
|
||||||
that you should keep initialized set elements in ascending order. The
|
that you should keep the enumerated elements in ascending order. The
|
||||||
following will produce a compiler error:
|
following will produce a compiler error:
|
||||||
\renewcommand{\prelisting}{\sffamily}
|
\renewcommand{\prelisting}{\sffamily}
|
||||||
\begin{listing}
|
\begin{listing}
|
||||||
@ -4131,7 +4135,7 @@ over its maximum value.
|
|||||||
\html{\input{refex/ex32.tex}}
|
\html{\input{refex/ex32.tex}}
|
||||||
\begin{procedure}{Insert}
|
\begin{procedure}{Insert}
|
||||||
\Declaration
|
\Declaration
|
||||||
Procedure Insert (Const Source : String;var S : String;Index : integer);
|
Procedure Insert (Const Source : String;var S : String;Index : Longint);
|
||||||
|
|
||||||
\Description
|
\Description
|
||||||
\var{Insert} inserts string \var{Source} in string \var{S}, at position
|
\var{Insert} inserts string \var{Source} in string \var{S}, at position
|
||||||
|
Loading…
Reference in New Issue
Block a user