On 2021-01-09 16:01, Christo Crause via fpc-devel wrote:

On Sat, Jan 9, 2021 at 3:52 PM Jonas Maebe via fpc-devel <fpc-devel@lists.freepascal.org> wrote:

Could your idea not be simplified by allowing the use of the section directive when defining a pointer?
type
Peeprom = pointer; section '.eeprom';

This way when a parameter is defined as e.g. type Peeprom the compiler knows what access code should be generated for the specified section. It would also help with compile time error checking where assigning a regular pointer to a section pointer should not be allowed (unless the user applies a type cast).

Something like that is definitely possible (and is similar to how LLVM handles cases like this: every pointer by default is in address space 0, but you can define as many additional address spaces as you want and associate pointers with them). However, it does not solve the issue with call-by-reference parameters. You can of course only allow those for the default address space, and require explicit pointers for other address spaces.


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to