tw35533.pp 524 B

123456789101112131415161718192021222324252627282930
  1. { %NORUN }
  2. program tw35533;
  3. {$mode delphiunicode}
  4. type
  5. TPointerHelper = record helper for pointer
  6. function AsNativeUint: nativeuint;
  7. function PCharLen: uint32;
  8. end;
  9. function TPointerHelper.AsNativeUint: nativeuint;
  10. begin
  11. Result := nativeuint(self);
  12. end;
  13. function TPointerHelper.PCharLen: uint32;
  14. begin
  15. Result := 5; //- Just here to illustrate the issue.
  16. end;
  17. var
  18. P: pointer;
  19. begin
  20. P := @ParamStr(0); //- Just a nonsense pointer.
  21. Writeln( P.AsNativeUInt );
  22. Writeln( P.PCharLen );
  23. Readln;
  24. end.