Assembly


[name] gives the user the possibility to embed assembly code in their programs. As this evades any type of compiler check, it is highly unsafe and only for expert users. It can only run in an unsafe context as well.

Syntax


asm ("assembly")

Assembly code can also access variables defined inside your code:

asm ("assembly" : constraints)

constraints


Unline C, where constraints are a genuine excruciating pain to work with (and clobbers are manual, because the compiler passes the code straight to the assembler in two different phases), [name] is actually your friend! There are no seprated inputs/outputs, and you cannot have registers as constraints. The constraints can only be LValues, and their address in memory is passed to the code with the placeholders %X, where X is an incremental number corresponding the index of the constraint.

Example


asm ( "mov eax, %0
       mov ebx, %1
       add eax, ebx
       mov %2, ebx" : x, y, z )

Sums x and y and puts the result in z.

Behaviour


There are no pragmas to alter the default behaviour of assembly statements.

The assembly


Yeah no this comes later