Sign in Join
Wiki copytemporary

compile time variables/de: what changed

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

Title: compile time variables/de

OldNewLine
1+Zurück zur [[using conditionals messages macros/de|Verwendung von Bedingungen, Nachrichten und Makros]].\
2+
3+Compile time Variablen können im MacPas Modus definiert werden.\
4+Sie unterscheiden sich dadurch von den Symbolen das sie einen Wert haben.\
5+Sie unterscheiden sich dadurch von den Makros, das Sie mit ihrem Wert keine Codeteile ersetzen können.\
6+Beispiel für den Unterschied von Macro und Compile time Variablen:\
7+
8+``` pascal
9+ {$mode MacPas}
10+ {$SETC ident := 4}
11+
12+ if ident = 4 then // dies führt zu einem Fehler (mit einem Makro ist das möglich)
13+ ...
14+ else
15+ ...;
16+```
17+
18+Jede weitere Definition einer Compile time Variablen mit dem selben Namen führt zum Überschreiben der vorhergehenden Compile time Variablen mit dem selben Namen.\
19+Im Compiler Modus {\$mode MacPas} sind Compile time Variablen immer erlaubt.\
20+Syntax für die Verwendung einer Compile time Variablen:\
21+{\$SETC ident := Ausdruck}\
22+
23+Beispiel:
24+
25+``` pascal
26+ {$mode MacPas}
27+ {$SETC ident := 4}
28+
29+ {$ifdef ident = 4}
30+ ...
31+ {$else}
32+ ...
33+ {$endif}
34+```
35+
36+---
37+*From the Free Pascal wiki, page "compile time variables/de", as it stood on 2020-02-11 after a change by Trev, 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