Sign in Join
Wiki copytemporary

compile time variables/de

Zurück zur Verwendung von Bedingungen, Nachrichten und Makros.\

Compile time Variablen können im MacPas Modus definiert werden.
Sie unterscheiden sich dadurch von den Symbolen das sie einen Wert haben.
Sie unterscheiden sich dadurch von den Makros, das Sie mit ihrem Wert keine Codeteile ersetzen können.
Beispiel für den Unterschied von Macro und Compile time Variablen:\

pascal
  {$mode MacPas}
  {$SETC ident := 4}

  if ident = 4 then         // dies führt zu einem Fehler (mit einem Makro ist das möglich)
    ...
  else
    ...;

Jede weitere Definition einer Compile time Variablen mit dem selben Namen führt zum Überschreiben der vorhergehenden Compile time Variablen mit dem selben Namen.
Im Compiler Modus {$mode MacPas} sind Compile time Variablen immer erlaubt.
Syntax für die Verwendung einer Compile time Variablen:
{$SETC ident := Ausdruck}\

Beispiel:

pascal
  {$mode MacPas}
  {$SETC ident := 4}

  {$ifdef ident = 4}
    ...
  {$else}
    ...
  {$endif}

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.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 2 people, 2013–2020

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
OlafCreated page
TrevFixed syntax highlighting; deleted category already in page template (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.