www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - volatile - and - CASE

reply Tom Popovich <Tom_member pathlink.com> writes:
volatile:  I see that volatile is not supported. many times in system
programming you need to tell the compiler that variable X might change
mysteriously and therefore should not be cached in a register.

You might want to support (maybe in a future release) this feature since its
easy to implement and useful [never cache the variable].

-Tom.

PS: I just started looking at D and it looks very nice and an excellent
idea. (dont let the nit-picking throw you off.)
Jul 19 2004
parent "Walter" <newshound digitalmars.com> writes:
"Tom Popovich" <Tom_member pathlink.com> wrote in message
news:cdie80$1518$1 digitaldaemon.com...
 volatile:  I see that volatile is not supported. many times in system
 programming you need to tell the compiler that variable X might change
 mysteriously and therefore should not be cached in a register.

 You might want to support (maybe in a future release) this feature since

 easy to implement and useful [never cache the variable].

Volatile has different semantics in C, C# and Java. The most useful meaning for it is to establish 'write barriers' and 'read barriers' to facilitate multi-threaded programming. The volatile statement in D accomplishes this. It's actually pretty rare to need volatile to put read cycles on hardware memory locations, in D that is best accomplished by doing one line if inline assembler, rather than rippling a volatile type modifier throughout the semantics of the language.
 PS: I just started looking at D and it looks very nice and an excellent
 idea. (dont let the nit-picking throw you off.)

Thanks!
Jul 20 2004