ARM bare-metal programming in D (cont) - volatile

Walter Bright newshound2 at digitalmars.com
Thu Oct 24 10:02:51 PDT 2013


On 10/24/2013 4:18 AM, eles wrote:
> On Thursday, 24 October 2013 at 06:48:07 UTC, Walter Bright wrote:
>> On 10/23/2013 11:19 PM, Mike wrote:
>>> Thanks for the answer, Walter. I think this would be acceptable in many (most?)
>>> cases, but not where high performance is needed I think these functions add too
>>> much overhead if they are not inlined and in a critical path (bit-banging IO,
>>> for example). Afterall, a read/write to a volatile address is a single atomic
>>> instruction, if done properly.
>>>
>>> Is there a way to tell D to remove the function overhead, for example, like a
>>> "naked" attribute, yet still retain the "volatile" behavior?
>>
>> You have to give up on volatile. Nobody agrees on what it means. What does
>> "don't optimize" mean? And that's not at all the same thing as "atomic".
>
> Is not about "atomize me", it is about "really *read* me" or "really *write* me"
> at that memory location, don't fake it, don't cache me. And do it now, not 10
> seconds later.

Like I said, nobody (on the standards committees) could agree on exactly what 
that meant.


More information about the Digitalmars-d mailing list