Memory mapped registers in C/C++: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
m typo--, some specification
m Bot: Replace deprecated source tag with syntaxhighlight
 
(One intermediate revision by one other user not shown)
Line 19:
Explicit memory barrier directives to the compiler are compiler specific. Volatile may work as a memory barrier, but it in many cases is an overoptimization. Where possible, avoid the use of volatile as a memory barrier, and prefer to use an explicit memory barrier directive to the compiler.
 
<sourcesyntaxhighlight lang="c">
// Explicit memory barrier for use with GCC.
asm volatile ("": : :"memory");</sourcesyntaxhighlight>
 
===CPU memory barriers===
Line 52:
 
==Useful References==
httphttps://www.kernel.org/doc/Documentation/process/volatile-considered-harmful.txtrst "Volatile Considered harmful"