DIP62: Volatile type qualifier for unoptimizable variables in embedded programming

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Tue Jul 15 10:33:35 PDT 2014


"Johannes Pfau"  wrote in message news:lq3nf4$rbp$1 at digitalmars.com...

> Did you even read the section that explains why volatility is a property
> of the memory address and not of the access (4.2.3)? What's your
> response to that?

This is true, and it's the ideal I guess, but I'm not sure that it makes it 
worth extending the type system for.

My use of volatile in C consists entirely of

#define SOME_REGISTER (*(volatile unsigned *)(BASE + OFFSET))

And this could easily be done in D with a wrapper around peek/poke 
functions. (assuming they're intrinsics and inlining/optimization works 
correctly)

So, the complexity it adds to the type system and overloading etc is not 
worth it for my use cases.  What are the other use cases where it pulls its 
weight? 



More information about the Digitalmars-d mailing list