What is an internal function of C ++?

Source: Internet
Author: User

I have never heard of internal functions for many c ++ students, and I have heard of them for the first time. What is an internal function? The English language is intrinsic function. This is a special function of the compiler. Its behavior is similar to that of the C ++ inline function. However, because it is provided by the compiler, the compiler is more familiar with it and is more conducive to optimization. For example, memcpy is an internal function. If the compiler chooses/optimization, the compiler inserts the running Code directly when generating the code instead of calling the function. This is similar to the inline function, but as mentioned above, the compiler has a better understanding of this optimization.
In VC ++, abnormaltermination is also an internal function.
The following is an introduction to Wikipedia:
This article is about compiler intrinsic functions. For X toolkit, see intrinsics.
In compiler theory, an intrinsic function is a function available in a given language whose implementation is handled specially by the compiler. typically, it substitutes a sequence of Automatically-generated instructions for the original function call, similar to an inline function. unlike an inline function though, the compiler has an intimate knowledge of the intrinsic function and can therefore better integrate it and optimize it for the situation. this is also called builtin function in specified ages.
Compilers that implement intrinsic functions generally enable them only when the user has requested optimization, falling back to a default implementation provided by the Language Runtime Environment otherwise.
Intrinsic functions are often used to explicitly implement vectorization and parallelization in ages which do not address such constructs. altivec and OpenMP are examples of APIs which use intrinsic functions to declare, respectively, vectorizable and multiprocessor-aware operations during compilation. the compiler parses the intrinsic functions and converts them into vector math or multiprocessing object code appropriate for the target platform.
Microsoft and Intel's C/C ++ compilers as well as GCC implement intrinsics that map directly to the x86 SIMD instructions (MMX, SSE, sse2, sse3, ssse3, sse4 ). in the latest version of the Microsoft Compiler (vc2005 as well as vc2008) inline assembly is not available when compiling for 64 bit windows, therefore intrinsics are necessary. to compensate for the lack of inline assembly, new intrinsics have been added that map to standard assembly instructions that are not normally accessible through C/C ++ (e.g.: Bit scan ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.