Is function call a memory barrier?

后端 未结 5 1991
情深已故
情深已故 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:28

    It's probalby going to get optimized, either because the compiler inlines the mecpy call and eliminates the first assignment, or because it gets compiled to RISC code or machine code and gets optimized there.

提交回复
热议问题