Inline Assembler

Previous GNU C Language Extensions Next

GCC introduces a special asm keyword to support assembler instructions within C code. Roughly, its syntax is:

asm ("instructions" [:output:input]);
The asm keyword may appear between usual lines of code or at the top level, outside of any function body. instructions may contain labels and references to global C symbols; in fact, the contents of the string are copied directly into the output file.

If you are writing a header file that should be includable in programs compiled in GCC's strict ISO C mode, write __asm__ instead of asm. See Alternate Keywords.