I need to know about the difference between intrinsic, inline and external functions in C and C++ programming – specifically, in relation to programming for an embedded, Arm/Neon-based system.
Intrinsic functions
Intrinsic functions are functions that the compiler implements directly when possible instead of calling an actual function in a library.
For example, they can be used for optimization or to reach specific hardware functionality.
For ARM, there exists an intrinsic function (and many others) called __nop()
, which inserts a single NOP (No Operation) instruction.
See the following links for more information:
Extern functions
Extern functions tell the compiler that something is defined elsewhere, so it doesn't complain about being undefined or becoming defined multiple times.
There is almost never any need to use the keyword extern
when declaring a function in C or C++, since they normally are linked this way by default.
See the following links for more information:
Inline functions
Inline functions are an optimization technique used by compilers, mostly to reduce execution time.
For example, if you have a small function (not inlined) with one input parameter, and you call this function multiple times,
the processor will (among other things):
Instead, if the function was inlined, it would replace the call statement with the function code itself and then compile the code.
See the following links for more information: