__fence -- Prevents code motion

Format

#include <builtin.h>
void __fence(void)

Language Level: None
__fence prevents the compiler from moving code across the call point in either direction.

Return Value
There is no return value from this function.

Example
This example shows how to insert a code motion fence into your program.

#include <stdio.h>
#include <builtin.h>
int main(void)
{
   printf("There is a code motion fence between this call to printf...\n");
   __fence();
   printf("and this one.\n");
   /****************************************************************
      The output should be:
      There is a code motion fence between this call to printf...
      and this one.
   ****************************************************************/
   return 0;
}