Note that there are some explanatory texts on larger screens.

plurals
  1. POConfused by UInt64
    primarykey
    data
    text
    <p>The code snippet below demonstrates a problem I am having with with text IO and UInt64 type variables in Delphi XE2 recently re-installed from a recent ISO image file - the compile fails with an error message relating to a missing Text.ReadUInt64 function or procedure. If I replace the failing line with</p> <pre><code> ReadLn(F,A); </code></pre> <p>then the program compiles, correctly writes </p> <pre><code>-1 18446744073709551615 </code></pre> <p>to the text file, and then (as expected) fails on the second read with an EInOutError: "Invalid Numeric Input". Do I have a corrupt install or has someone failed to write a ReadUInt64 function? The only reference to ReadUInt64 that I can find in help is the following definition:</p> <pre><code>function ReadUInt64: UInt64; virtual; </code></pre> <p>in System.Classes.TBinaryReader.ReadUInt64. I'm not sure if this is the 'same' function or, if so, why it is virtual...</p> <p>I am also a little confused by Help's reference to UInt64. It defines it as: </p> <pre><code>type UInt64 = Int64; </code></pre> <p>If this is correct, how does the compiler know to treat an UInt64 differently to an Int64 variable?</p> <pre><code>procedure TForm1.Button1Click(Sender: TObject); var F : TextFile; A : Int64; B : Uint64; begin { Compiler warns on following line with message: [DCC Warning] Unit1.pas(32): W1012 Constant expression violates subrange bounds } A := $FFFFFFFFFFFFFFFF; B := $FFFFFFFFFFFFFFFF; AssignFile(F,'test.txt'); ReWrite(F); Writeln(F,A); Writeln(F,B); CloseFile(F); AssignFile(F,'test.txt'); ReSet(F); ReadLn(F,A); { Fails to compile on following line with message: [DCC Fatal Error] Unit1.pas(42): E2158 System unit out of date or corrupted: missing 'Text.ReadUInt64' } ReadLn(F,B); CloseFile(F); end; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload