[fpc-pascal] Illogical automatic dereferencing

Aleksa Todorovic alexione at gmail.com
Tue Oct 13 12:12:20 CEST 2009


On Mon, Oct 12, 2009 at 22:03, "Vinzent Höfler"
<JeLlyFish.software at gmx.net> wrote:

> BTW, the expression "@DynamicArray" should really return the address of the first element, not the address of the pointer to the array structure.

What's wrong with the current solution?

"the first element" = DynamicArray[0]
"address of the first element" -> @DynamicArray[0]

Makes perfect sense :-)


> It somehow destroys the abstraction. And I can't imagine any situation where the pointer might be of the interest for the user of the abstraction.

That really doesn't matter. What matters is consistency. Pointer to
variable X is defined as address of the first byte of memory where
variable X is stored. If you work with pointers to complex data types,
you have to be aware of internal structure. Otherwise, don't use
pointers - they are evil anyway :-)



More information about the fpc-pascal mailing list