www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Volatile

reply Florian RIVOAL <Florian_member pathlink.com> writes:
Hi,

I am new here. I am quite impressed and interested in this D language. While
reading the feature list, i couln't help thinking "wow, this is just what i
need" every two or three lines.

But in what i have read until now, there is a small detail that leaves me a bit
skeptical. Its about having a volatile statement type, instead of a type
modifier. What makes it better? To my understanding, a volatile resource is
quite likely to stay volatile all the time, so why not declare it in the first
place, and let the compiler manage it?

There might be cases where it is usefull to have volatile statement. But to me,
votatile as a modifier is also justified, since it can prevent many mistakes.
You don't want to think every single time you use a variable if it is volatile
or not. If you know one variable is volatile, say it once, and let the compiler
do it's job.

Or did I miss the point?
Jul 08 2004
parent Regan Heath <regan netwin.co.nz> writes:
Hi,

See the threads:
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/792
http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/4712

for the reasoning.

Regan

On Fri, 9 Jul 2004 04:50:11 +0000 (UTC), Florian RIVOAL 
<Florian_member pathlink.com> wrote:

 Hi,

 I am new here. I am quite impressed and interested in this D language. 
 While
 reading the feature list, i couln't help thinking "wow, this is just 
 what i
 need" every two or three lines.

 But in what i have read until now, there is a small detail that leaves 
 me a bit
 skeptical. Its about having a volatile statement type, instead of a type
 modifier. What makes it better? To my understanding, a volatile resource 
 is
 quite likely to stay volatile all the time, so why not declare it in the 
 first
 place, and let the compiler manage it?

 There might be cases where it is usefull to have volatile statement. But 
 to me,
 votatile as a modifier is also justified, since it can prevent many 
 mistakes.
 You don't want to think every single time you use a variable if it is 
 volatile
 or not. If you know one variable is volatile, say it once, and let the 
 compiler
 do it's job.

 Or did I miss the point?
-- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 08 2004