Einzelnen Beitrag anzeigen

Win32.API

Registriert seit: 23. Mai 2005
312 Beiträge
 
#4

Re: Rückgabewert einer Function Int64 mit Fehlercode

  Alt 20. Mai 2009, 16:09
Alternative zwei (ich bevorzuge aber auch die exceptions ...):

Delphi-Quellcode:
function TData.GetFileData(var AValue: Int64) : Boolean;
begin
  if not isEmpty() then
    begin
      AValue:=Int64Data[DataPointer - 1];
      result := true;
    end
  else
   result := false;
end;
--Win32


Oder bei sowenig code in der Funktion:

Delphi-Quellcode:
TInt64Result = record
 Failed: Boolean;
 Value: Int64;
end;


function TData.GetFileData() : TInt64Result;
begin
  if not isEmpty() then
    begin
      result.Value :=Int64Data[DataPointer - 1];
      result.Failed := false;
    end
  else
   result.Failed := true;
end;
  Mit Zitat antworten Zitat