[fpc-pascal] Illogical automatic dereferencing
"Vinzent Höfler"
JeLlyFish.software at gmx.net
Sat Oct 10 19:58:52 CEST 2009
Henry Vermaak <henry.vermaak at gmail.com>
> I can't understand what you are trying to say. An array is a pointer
> to where the elements of the array resides in memory.
No, not in Pascal. In Pascal an array is a variable just like any other: A name for some memory area where values can be stored.
> How else do you think it works?
Just like "a : integer" -> reserve the needed number of bytes and let the programmer access the associated memory via the identifier "a".
> Can you explain what would x[1] mean if it isn't dereferenced?
Access the memory at address of "x + 1 * (size of element)".
Just like you do
array4 : record a1, a2, a3, a4 end;
and access the record members respectively. It's a static address, known at compile time. No dereferencing.
> No, it's not weakened by C-style all of a sudden, it's _always_ been
> like this.
No. Your confusing arrays and pointers. Or maybe, you're confusing Pascal and C.
> As I've been trying to explain to you, there's no "obscure
> compiler magic", if you put the brackets there, the compiler
> dereferences.
The dereferencing operator in Pascal is "^".
Vinzent.
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
More information about the fpc-pascal
mailing list