DIP62: Volatile type qualifier for unoptimizable variables in embedded programming

Johannes Pfau via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 15 11:28:11 PDT 2014


Am Tue, 15 Jul 2014 18:13:26 +0000
schrieb "Meta" <jared771 at gmail.com>:

> >
> > Also some things will just not work with Volatile!T, for example
> > volatile/nonvolatile member function overloading.
> 
> Functions can take Volatile!T, of course, and you can always have 
> "set/volatileSet". You might even be able to use opDispatch to 
> make it less DRY.

No, this doesn't work with Volatile!:

struct A
{
    private int _val;
    int read(){ return val+val };
    int read() volatile { auto tmp = val; return tmp*tmp; };
}

opDispatch sounds _awesome_ for systems with a few KB of SRAM. People
here always have nice ideas but will you implement it and tune it until
it has as little overhead as the C version?


More information about the Digitalmars-d mailing list