[Bug 126] Add support for attribute to mark data as volatile.

via D.gnu d.gnu at puremagic.com
Fri May 23 07:59:03 PDT 2014


http://bugzilla.gdcproject.org/show_bug.cgi?id=126

--- Comment #5 from Johannes Pfau <johannespfau at gmail.com> ---
Oh, and back to topic:

> I am quite open to solutions, other than I don't think 'volatile' as a keyword > would be something reintroduced to the language am afaid.

Yes, that's what I fear as well. But thinking about it volatility is a property
of the memory location and that best maps to a type qualifier. (It's not
exactly the same thing, but we also have this conflation for immutable type /
read only memory and in practice it should work fine).

That's one reason why peek/poke are dangerous, just like the old D1 volatile
statements: If a volatile memory area is typed as a normal pointer you can
still pass it to functions which access it in 'non-volatile' ways.


OTOH one of the biggest problems with volatile in C is that it's not properly
standardized. If we invent GDC/LDC only solutions these will likely be slightly
different causing the same mess as in C/C++ (or even worse, if we don't have a
standard at all). So this is something which would really benefit from being
part of the D standard. Maybe there's some chance we can introduce a new type
qualifier, if not we'll have to do the next best thing, whatever that may be.

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/d.gnu/attachments/20140523/d31a9b1f/attachment.html>


More information about the D.gnu mailing list