代码之家  ›  专栏  ›  技术社区  ›  Toon Krijthe

Delphi和pointermath(文档中可能存在的错误)

  •  -2
  • Toon Krijthe  · 技术社区  · 17 年前

    指针

    RAD-Studio
      Reference
        Delphi Reference
          Delphi Language Guide
            Fundamental Syntactic Elements
              Fundamental Syntactic Elements
                [Directives]
    

    我知道这是一个编译器指令{$POINTERMATH ON | OFF},但我不知道如何使用这个家伙。帮助中没有其他信息,所以我尝试了一些东西,但没有成功。

    procedure Name; pointermath; // gave an error
    

    因此有几种可能性:

    • 这是帮助中的一个错误。
    • 我还没有找到合适的地方使用它。

    赛尔德 必须是 密封的 ).

    有人知道这个指令吗?

    4 回复  |  直到 17 年前
        1
  •  2
  •   PetriW    17 年前

    Pointermath允许您执行以下操作:

    {$POINTERMATH ON}
    procedure Test;
    var
      temp: PWord;
    begin
      temp := anAddress;
      temp := temp + 16;
      // temp now points to anAddress+$20 (2*16)
    end;
    

    本质上,这意味着您不再需要将指针类型转换为整数以使其递增一个数值。

        2
  •  2
  •   Community Mohan Dere    9 年前

    除非 Barry Kelly 证明我们错了(他是这方面的权威),我会投票支持一个文档错误:它是为 指令章节。

        3
  •  1
  •   Toon Krijthe    17 年前

    Codegear已经确认这是一个bug。

        4
  •  0
  •   Steve    17 年前