I always thought it was but many IDEs and syntax highlighting tools do not highlight ASM in C, but they always do with C++. Is inline assembly part of the C standard (ANSII or ISO) or not?
See Question&Answers more detail:osI always thought it was but many IDEs and syntax highlighting tools do not highlight ASM in C, but they always do with C++. Is inline assembly part of the C standard (ANSII or ISO) or not?
See Question&Answers more detail:osIt's not in the ISO C standard (n1570 draft of C2011) as such, but mentioned in annex J (common extensions):
J.5.10 The asm keyword
1 The asm keyword may be used to insert assembly language directly into the translator output (6.8). The most common implementation is via a statement of the form:
asm ( character-string-literal );
Annex J is informative, not normative, so an implementation need not provide inline assembly, and if it does it's not prescribed in which form. But it's a widespread extension, though not portable since compilers do indeed implement it differently.
In the C++ standard (n3376 draft of the C++11 standard), it is mentioned in the body of the standard
7.4 The asm declaration [dcl.asm]
1 An asm declaration has the form
asm-definition:
asm ( string-literal ) ;
The asm declaration is conditionally-supported; its meaning is implementation-defined. [ Note: Typically it is used to pass information through the implementation to an assembler. — end note ]
but also not mandatory, and with implementation-defined interpretation.