ページの改善
いますぐフォークしてオンライン編集し、このページのプルリクエストを送信します。
Github へのログインが必要です。 これは小さな変更に適しています。
大きな変更を加えたい場合は、通常の cloneの使用をお勧めします。
日本語版について
個人的な学習のために、dlang.orgを翻訳したサイトです。
翻訳に際して、様々なサイトを参考にしています。
core.builtins
To provide access to features that would be otherwise counterproductive or
difficult to implement, compilers provide an interface consisting of a set
of builtins (also called intrinsics) which can be called like normal functions.
This module exposes builtins both common to all D compilers
(those provided by the frontend) and specific to the host compiler i.e. those
specific to either LLVM or GCC (ldc.intrinsics and gcc.
builtins
are publicly imported, respectively).
Host-specific intrinsics cannot be reliably listed here, however listings can be found
at the documentation for the relevant backends, i.e.
GCC and
LLVM. It should be noted that not all
builtins listed are necessarily supported by the host compiler, please file a bug
if this is the case for your workload.
Use of this module reduces the amount of conditional compilation needed
to use a given builtin. For example, to write a target independent function
that uses prefetching we can write the following:
float usePrefetch(float[] x) { // There is only one import statement required rather than two (versioned) imports import core.builtins; version (GNU) __builtin_prefetch(x.ptr); version (LDC) /+ For the curious: 0, 3, 1 mean `x` will only be read-from (0), it will be used very often (3), and it should be fetched to the data-cache (1). +/ llvm_prefetch(x.ptr, 0, 3, 1); const doMath = blahBlahBlah; return doMath; }
License:
Authors:
Walter Bright
Source core/builtins.d
- pure nothrow @nogc @safe void
__ctfeWrite
(scope const(char)[]s
); - Writes
s
to stderr during CTFE (does nothing at runtime).
Copyright © 1999-2022 by the D Language Foundation | Page generated by
Ddoc on Wed Nov 23 08:33:04 2022