C++ asm


Example

The asm keyword takes a single operand, which must be a string literal. It has an implementation-defined meaning, but is typically passed to the implementation's assembler, with the assembler's output being incorporated into the translation unit.

The asm statement is a definition, not an expression, so it may appear either at block scope or namespace scope (including global scope). However, since inline assembly cannot be constrained by the rules of the C++ language, asm may not appear inside a constexpr function.

Example:

[[noreturn]] void halt_system() {
    asm("hlt");
}