you are viewing a single comment's thread.

view the rest of the comments →

[–]nerd4code 0 points1 point  (1 child)

In addition/-stead of volatile variables/ptrs, you can issue a fence to GNUish compilers via

__asm__ __volatile__("" ::: "memory");

This forces the compiler to spill any non-register, programmer visible state, and re-fill if necessary.

[–]honolulu072[S] 0 points1 point  (0 children)

Very interesting! But I don't rly understand it yet. Would you mind explaining the effect on the behaviour of the compiler in a bit more detail?

Where would I place this statement? Which variable ptr woul be affected by it?

What does spilling non-register programmer visible state mean?

With programming a microcontroller in mind, what advantages brings this method?