Hello,
like the Topic says: what is the Difference between:
@
and
Pointer ?
I was thinking that @ is the same as Pointer - only as short Form ...
I have the follow Code (which produce Error):
Error: Can't assign values to an address
function Foo: String;
begin
...
GetMem(@result, len + 1);
...
end;
Then I had replace @ with Pointer, and all will done okay:
function Foo: String;
begin
...
GetMem(Pointer(result), len + 1);
...
end;
The pointer in code is "UnTypePointer"
"@" is for return address
Many newcomers might be confused.
Here,
"New", "Dispose" I use for dynamic allocation like [type .. record]
"New", "Dispose", ".free" I use for dynamic allocation like [type .. class]
"GetMem" , "Finalize" and "FreeMem" I use for allocation array like {type ..record Pointer[0] .. Pointer[n]}
I attach sample code of pointer: (AllAboutPointer01.zip)
- TClassDataPointer to UnTypePointer
-UnTypePointer to TClassDataPointer
- TRecordDataPointer to UnTypePointer
- UnTypePointer to TRecordDataPointer
- Display result within the pointer
- Compair type of pointer
- Display type of pointer
- Free memory UnTypePointer
- Free memory TClassDataPointer
- Free memory TRecordDataPointer
Sorry to replying old forum.
