DIP62: Volatile type qualifier for unoptimizable variables in embedded programming

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 15 14:16:20 PDT 2014


Johannes Pfau:

> //In runtime:
> enum int* SOME_REG = 0xFFFF;
>
> //In user code
> peek(SOME_REG);
> poke(SOME_REG);
> *SOME_REG = 1; //Oops, forgot poke! This is not acceptable

Perhaps this syntax:

volatile enum int* SOME_REG = 0xFFFF;

Could turn this in a syntax error (only peek/poke are allowed to 
write and read from this address):

*SOME_REG = 1;

Bye,
bearophile


More information about the Digitalmars-d mailing list