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

eles eles at eles.com
Thu Oct 24 04:18:56 PDT 2013


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.


More information about the Digitalmars-d mailing list