title: What happens when AnsiString is cast to PAnsiString?
body: <p>I have the method (Delphi 2009):</p>
  
  <pre><code>procedure TAnsiStringType.SetData(const Value: TBuffer; IsNull: boolean = False);
  begin
    if not IsNull then
      FValue:= PAnsiString(Value)^;
    inherited;
  end;
  </code></pre>
  
  <p>This is an abstract method on the base class, where "Value: Pointer" expects the pointer of the corresponding data, as:</p>
  
  <pre><code>String = PString
  AnsiString = PAnsiString
  Integer = PInteger
  Boolean = PBoolean
  </code></pre>
  
  <p>So I try to pass the value like this:</p>
  
  <pre><code>var
    S: AnsiString;
  begin
    S:= 'New AnsiString Buffer';
    SetBuffer(PAnsiString(S));
  end;
  </code></pre>
  
  <p>But a cast from AnsiString to PAnsiString does NOT work, I can see why, but I want to know what the result of the casting is. So I wrote a simple test:</p>
  
  <pre><code>var
    Buffer: AnsiString;
    P1: Pointer;
    P2: Pointer;
    P3: Pointer;
    P4: Pointer;
  begin
    P1:= PAnsiString(Buffer);
    P2:= Addr(Buffer);
    P3:= @Buffer;
    P4:= Pointer(Buffer);
    P5:= PChar(Buffer[1]);
  
    WriteLn('P1: ' + IntToStr(Integer(P1)));
    WriteLn('P2: ' + IntToStr(Integer(P2)));
    WriteLn('P3: ' + IntToStr(Integer(P3)));
    WriteLn('P4: ' + IntToStr(Integer(P4)));
    WriteLn('P5: ' + IntToStr(Integer(P5)));
  end;
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>P1: 5006500
  P2: 1242488
  P3: 1242488
  P4: 5006500
  P5: 67
  </code></pre>
  
  <p>Where:</p>
  
  <pre><code>- P2 and P3, is the address of Buffer: AnsiString 
  - P5 is the Char Ord value of Buffer[1] char, in this case "67 = C"
  - How about P1 and P4?
  </code></pre>
  
  <p><strong>What is the meaning of P1 and P4?</strong></p>