Hairy Pixels via fpc-pascal said on Sun, 25 Jun 2023 11:20:53 +0700 >> On Jun 24, 2023, at 8:00 PM, Steve Litt via fpc-pascal >> <fpc-pascal@lists.freepascal.org> wrote: >> >> I don't do much with Pascal pointers, but it looks to me like you: >> >> * Set p to the address of i >> * Set the contents of p to 100 >> * Read the contents of p, which of course would be the value of i, >> 100 >> * Read the contents of p+1, which would be one integer width away on >> the stack, and has not been assigned to anything. > >Indeed that's what it's doing. It's strange as an array syntax though >which suggests there's a range of uniform elements, when in reality >there's just a pointer to a single location. > >I think the more correct Pascal way to do it would be define an array >type and pointer to that type and then subscript that instead of the >C-style way.
Why do you need pointers at all? Pointers aren't *usually* an asset. SteveT Steve Litt Autumn 2022 featured book: Thriving in Tough Times http://www.troubleshooters.com/bookstore/thrive.htm _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal