naming convention of temp local variables

后端 未结 11 1190
我在风中等你
我在风中等你 2021-01-23 05:40

What is the standard way to name a temp variable in the local function? let me give you an illustration of what I am doing. I get a pointer to a structure, so I want store one o

11条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-23 05:46

    My suggestion is to simply incorporate the original variable name, or some other identifier that alerts readers of its intented function.

    struct  Foo
    {
      double m_d;
    
    };
    
    
    void function (Foo* f)
    {
       double m_d_tmp = f->m_d;
    
           /***Other stuff***/
    
         f->m_d = m_d_tmp;
    }
    

提交回复
热议问题