OLD | NEW |
1 {{+bindTo:partials.standard_nacl_article}} | 1 {{+bindTo:partials.standard_nacl_article}} |
2 | 2 |
3 <section id="pnacl-c-c-language-support"> | 3 <section id="pnacl-c-c-language-support"> |
4 <h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1> | 4 <h1 id="pnacl-c-c-language-support">PNaCl C/C++ Language Support</h1> |
5 <div class="contents local" id="contents" style="display: none"> | 5 <div class="contents local" id="contents" style="display: none"> |
6 <ul class="small-gap"> | 6 <ul class="small-gap"> |
7 <li><p class="first"><a class="reference internal" href="#source-language-suppor
t" id="id3">Source language support</a></p> | 7 <li><p class="first"><a class="reference internal" href="#source-language-suppor
t" id="id3">Source language support</a></p> |
8 <ul class="small-gap"> | 8 <ul class="small-gap"> |
9 <li><a class="reference internal" href="#versions" id="id4">Versions</a></li> | 9 <li><a class="reference internal" href="#versions" id="id4">Versions</a></li> |
10 <li><a class="reference internal" href="#preprocessor-definitions" id="id5">Prep
rocessor definitions</a></li> | 10 <li><a class="reference internal" href="#preprocessor-definitions" id="id5">Prep
rocessor definitions</a></li> |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 <li><code>libstdc++</code>: use the <code>_GLIBCXX_VERSION</code> macro.</li> | 57 <li><code>libstdc++</code>: use the <code>_GLIBCXX_VERSION</code> macro.</li> |
58 </ul> | 58 </ul> |
59 <h3 id="preprocessor-definitions">Preprocessor definitions</h3> | 59 <h3 id="preprocessor-definitions">Preprocessor definitions</h3> |
60 <p>When compiling C/C++ code, the PNaCl toolchain defines the <code>__pnacl__</c
ode> | 60 <p>When compiling C/C++ code, the PNaCl toolchain defines the <code>__pnacl__</c
ode> |
61 macro. In addition, <code>__native_client__</code> is defined for compatibility | 61 macro. In addition, <code>__native_client__</code> is defined for compatibility |
62 with other NaCl toolchains.</p> | 62 with other NaCl toolchains.</p> |
63 <h2 id="memory-model-and-atomics"><span id="id1"></span>Memory Model and Atomics
</h2> | 63 <h2 id="memory-model-and-atomics"><span id="id1"></span>Memory Model and Atomics
</h2> |
64 <h3 id="memory-model-for-concurrent-operations">Memory Model for Concurrent Oper
ations</h3> | 64 <h3 id="memory-model-for-concurrent-operations">Memory Model for Concurrent Oper
ations</h3> |
65 <p>The memory model offered by PNaCl relies on the same coding guidelines | 65 <p>The memory model offered by PNaCl relies on the same coding guidelines |
66 as the C11/C++11 one: concurrent accesses must always occur through | 66 as the C11/C++11 one: concurrent accesses must always occur through |
67 atomic primitives (offered by <a class="reference external" href="PNaClLangRef.h
tml#atomicintrinsics">atomic intrinsics</a>), and these accesses must always | 67 atomic primitives (offered by <a class="reference internal" href="/native-client
/reference/pnacl-bitcode-abi.html#bitcode-atomicintrinsics"><em>atomic intrinsic
s</em></a>), and these accesses must always |
68 occur with the same size for the same memory location. Visibility of | 68 occur with the same size for the same memory location. Visibility of |
69 stores is provided on a happens-before basis that relates memory | 69 stores is provided on a happens-before basis that relates memory |
70 locations to each other as the C11/C++11 standards do.</p> | 70 locations to each other as the C11/C++11 standards do.</p> |
71 <p>Non-atomic memory accesses may be reordered, separated, elided or fused | 71 <p>Non-atomic memory accesses may be reordered, separated, elided or fused |
72 according to C and C++’s memory model before the pexe is created as well | 72 according to C and C++’s memory model before the pexe is created as well |
73 as after its creation. Accessing atomic memory location through | 73 as after its creation. Accessing atomic memory location through |
74 non-atomic primitives is <a class="reference internal" href="/native-client/refe
rence/pnacl-undefined-behavior.html#undefined-behavior"><em>Undefined Behavior</
em></a>.</p> | 74 non-atomic primitives is <a class="reference internal" href="/native-client/refe
rence/pnacl-undefined-behavior.html#undefined-behavior"><em>Undefined Behavior</
em></a>.</p> |
75 <p>As in C11/C++11 some atomic accesses may be implemented with locks on | 75 <p>As in C11/C++11 some atomic accesses may be implemented with locks on |
76 certain platforms. The <code>ATOMIC_*_LOCK_FREE</code> macros will always be | 76 certain platforms. The <code>ATOMIC_*_LOCK_FREE</code> macros will always be |
77 <code>1</code>, signifying that all types are sometimes lock-free. The | 77 <code>1</code>, signifying that all types are sometimes lock-free. The |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 <p>Neither PNaCl nor NaCl currently support asynchronous interruption | 432 <p>Neither PNaCl nor NaCl currently support asynchronous interruption |
433 or suspension of threads.</p> | 433 or suspension of threads.</p> |
434 </li> | 434 </li> |
435 </ul> | 435 </ul> |
436 <p>If PNaCl were to support either of these, the interaction of | 436 <p>If PNaCl were to support either of these, the interaction of |
437 <code>volatile</code> and atomics with same-thread signal handling would need | 437 <code>volatile</code> and atomics with same-thread signal handling would need |
438 to be carefully detailed.</p> | 438 to be carefully detailed.</p> |
439 </section> | 439 </section> |
440 | 440 |
441 {{/partials.standard_nacl_article}} | 441 {{/partials.standard_nacl_article}} |
OLD | NEW |