Is function call a memory barrier?

后端 未结 5 2011
情深已故
情深已故 2020-12-24 13:52

Consider this C code:

extern volatile int hardware_reg;

void f(const void *src, size_t len)
{
    void *dst = ;

    hardware_reg = 1;    
         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-24 14:34

    My assumption would be that the compiler never re-orders volatile assignments since it has to assume they must be executed at exactly the position where they occur in the code.

提交回复
热议问题