/* * Inline assembly snippet * Polprog 2018 * 3 clause BSD */ #include #include int main(){ volatile uint32_t a = 0; while (a < 10){ asm volatile (" \ incl %[a] \ ":[a] "=m" (a) :: "cc"); //asm : out operands : in operands : clobbers /*inc with l ("long") suffix, since we are incrementing a *memory* address *long because a is 32 bit wide, volatile since we modify the memory address */ std::cout << "A = " << a << std::endl; } }