What is aliasing and how does it affect performance?

前端 未结 4 1893
迷失自我
迷失自我 2021-02-04 02:19

At the GoingNative event, during the Interactive Panel on Day2 at the 9 minute mark, Chandler Carruth says:

Pointers create aliasing problems. They slow d

4条回答
  •  醉话见心
    2021-02-04 02:54

    a pointer is a value that represents a memory address sometimes 2 pointers can represent the same memory address thats what aliasing is

    int * p;
    *p = 5;
    
    int * alias;
    alias = p;
    

    the variable alias is an alias of p and *alias is equal to 5 if you change *alias then *p changes along with it

提交回复
热议问题