diff options
Diffstat (limited to 'files/zh-cn/mozilla/mfbt/index.html')
-rw-r--r-- | files/zh-cn/mozilla/mfbt/index.html | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/files/zh-cn/mozilla/mfbt/index.html b/files/zh-cn/mozilla/mfbt/index.html deleted file mode 100644 index a8b644e23f..0000000000 --- a/files/zh-cn/mozilla/mfbt/index.html +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: Mozilla Framework Based on Templates (MFBT) -slug: Mozilla/MFBT -translation_of: Mozilla/MFBT ---- -<p><span class="seoSummary">The Mozilla Framework Based on Templates ("mfbt") is the central repository for macros, functions, and data structures used throughout Mozilla code, including in the JavaScript engine.</span> Its code resides in the <code>{{ Source("mfbt/") }}</code> source directory, but headers within it should be included using paths like <code>"mozilla/StandardInteger.h"</code>. It is fairly new, so its functionality is currently sparse. Feel free to <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&component=MFBT" title="https://bugzilla.mozilla.org/enter_bug.cgi?product=Core&product=MFBT">file bugs</a> to add new functionality to it, or to move existing functionality into it, as needed. </p> - -<p>mfbt code goes to some length to document all its interfaces in comments, including examples when possible. It also attempts to define its functionality in well-named files, such that simply skimming the contents of <code>{{ Source("mfbt/") }}</code> will quickly suggest the relevant header to examine. Therefore this document primarily attempts to direct readers to the correct file to read those comments. Feel free to file a <a class="link-https" href="https://bugzilla.mozilla.org/enter_bug.cgi?bug_status=NEW&cc=mfbt%40core.bugs&comment=&component=Documentation%20Requests&product=Mozilla%20Developer%20Network&qa_contact=doc-request%40mdn.bugs&rep_platform=All&op_sys=All" title="https://bugzilla.mozilla.org/enter_bug.cgi?bug_status=NEW&cc=mfbt%40core.bugs&comment=&component=Documentation%20Requests&product=Mozilla%20Developer%20Network&qa_contact=doc-request%40mdn.bugs&rep_platform=All&op_sys=All">documentation bug</a> if you think this approach could be improved, and feel free to make improvements to this document if you see them.</p> - -<h2 id="Functionality">Functionality</h2> - -<h3 id="Types_and_type_manipulation">Types and type manipulation</h3> - -<p><code>{{ Source("mfbt/StandardInteger.h", "StandardInteger.h") }}</code> implements the <code><stdint.h></code> interface. (The <code><stdint.h></code> standard header is not available on all platforms and so cannot be used directly. This header also provides a useful "hook" for embeddings that must customize the types underlying the fixed-size integer types.)</p> - -<p><code>{{ Source("mfbt/Types.h", "Types.h") }}</code> includes <code>StandardInteger.h</code> and further provides <code>size_t</code>.</p> - -<p><code>{{ Source("mfbt/CheckedInt.h", "CheckedInt.h") }}</code> implements checked integers. They behave like integers, but safely check for integer overflow and divide-by-zero. Useful for input validation.</p> - -<p><code>{{ Source("mfbt/FloatingPoint.h", "FloatingPoint.h") }}</code> provides various operations for examining and working upon double-precision floating point values, and for producing various special floating point values.</p> - -<h3 id="Core">Core</h3> - -<p><code>{{ Source("mfbt/Types.h", "Types.h") }}</code> further provides macros to define imported and exported C symbols.</p> - -<p><code>{{ Source("mfbt/Attributes.h", "Attributes.h") }}</code> implements various function and class attribute macros. The function macros control inlining, note whether a function returns, and enforce various C++-related restrictions on inheritance and use. The class macros permit controlling the inheritability of a class.</p> - -<p><code>{{ Source("mfbt/Likely.h", "Likely.h") }}</code> provides <code>MOZ_LIKELY</code> and <code>MOZ_UNLIKELY</code> macros to annotate conditions with their expected truthiness.</p> - -<p><code>{{ Source("mfbt/Util.h", "Util.h") }}</code> implements various other bits of useful functionality. (This header will likely be further split up so that its functionality is less grab-bag.)</p> - -<h3 id="Debugging">Debugging</h3> - -<p><code>{{ Source("mfbt/Assertions.h", "Assertions.h") }} </code>provides assertion macros in implementing runtime assertions and compile-time assertions.</p> - -<p><code>{{ Source("mfbt/GuardObjects.h", "GuardObjects.h") }}</code> provides macros which can be used to annotate an <a class="external" href="http://en.wikipedia.org/wiki/RAII" title="http://en.wikipedia.org/wiki/RAII">RAII</a>-style guard class, so that any attempt to create an unnamed temporary for it will assert. (An unnamed temporary lives for a shorter period of time than the scope where it's found, so it usually isn't what was desired.)</p> - -<h3 id="Data_structures">Data structures</h3> - -<p><code>{{ Source("mfbt/LinkedList.h", "LinkedList.h") }}</code> implements a type-safe doubly-linked list class. Most new code should use this rather than <code>{{ Source("nsprpub/pr/include/prclist.h", "PRCList") }}</code>.</p> - -<p><code>{{ Source("mfbt/RangedPtr.h", "RangedPtr.h") }} </code>implements <code>RangedPtr</code>, a smart pointer template whose value may be manipulated only within a range specified at construction time, and which may be dereferenced only at valid locations in that range. This pointer is a useful way to expose access to values within an array.</p> - -<p><code>{{ Source("mfbt/RefPtr.h", "RefPtr.h") }} </code>implements various smart pointer templates to simplify reference counting of values of particular classes.</p> - -<p><code>{{ Source("mfbt/Scoped.h", "Scoped.h") }}</code> implements scope-based resource management, to simplify the task of cleaning up resources when leaving a scope.</p> - -<p><code>{{ Source("mfbt/ThreadLocal.h", "ThreadLocal.h") }}</code> implements thread-local storage, aka "TLS", also called thread-specific storage. It should be used only for static-storage-duration variables, such as global variables or static class members.</p> |