Sign in Join
Wiki copytemporary

Revision 1 of 1, by Trev on 2-20-2020. The page as it is now.

maxint/de

MAXINT ist eine globale Konstante. Ihr Wert entspricht nach ISO 7185 dem maximalen positiven Wert, der in einem Datenfeld vom Datentyp-Integer gespeichert werden kann.\

Das folgende Beispiel einer Konsolen- / Terminal-Anwendung zeigt wie diese Werte auf dem verwendeten System belegt sind:

pascal
program maxvals;
{$mode objfpc}{$H+}
{$IMPLICITEXCEPTIONS OFF}

const
  Width = 45;

begin
  writeln;
  writeln('Diese Werte sind vom Compiler-Modus abhaengig:');
  writeln('----------------------------------------------------------------');
  // Die Konstante MaxInt
  writeln('maxint:           :', maxint: Width);
  // Ermittlung des höchtmöglichen positiven Wertes der Variablen Integer
  writeln('high( integer )   :', high(integer): Width);
  writeln;
  writeln('Diese Variablen beispielsweise haben eine andere, feste Groesse: ');
  writeln('----------------------------------------------------------------');
  // Ermittlung des höchtmöglichen positiven Wertes der Variablen Int8
   writeln('high( int8 )      :', high(int8): Width);
  // Ermittlung des höchtmöglichen positiven Wertes der Variablen Int16
   writeln('high( int16 )     :', high(int16): Width);
  // Ermittlung des höchtmöglichen positiven Wertes der Variablen Int32
  writeln('high( int32 )     :', high(int32): Width);
  // Ermittlung des höchtmöglichen positiven Wertes der Variablen Int64
  writeln('high( int64 )     :', high(int64): Width);
  writeln;
  writeln('----------------------------------------------------------------');
  // Ermittlung der aktuellen CPU
  Write('Verwendete CPU    :');
  // Bedingte Compilierung - Anfang
{$IFDEF cpu64}
  Writeln('cpu64': Width);
{$ENDIF}
{$IFDEF cpu32}
  Writeln('cpu32': Width);
{$ENDIF}
{$IFDEF cpu16}
  Writeln('cpu16': Width);
{$ENDIF}
  // Bedingte Compilierung - Ende
  writeln;
  writeln;
end.

--Olaf 20:13, 2 December 2013 (CET)


From the Free Pascal wiki, page "maxint/de", as it stood on 2020-02-20 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.