What does `m_` variable prefix mean?

前端 未结 9 744
太阳男子
太阳男子 2020-12-22 18:47

I often see m_ prefix used for variables (m_World,m_Sprites,...) in tutorials, examples and other code mainly related

9条回答
  •  梦毁少年i
    2020-12-22 19:15

    Lockheed Martin uses a 3-prefix naming scheme which was wonderful to work with, especially when reading others' code.

       Scope          Reference Type(*Case-by-Case)   Type
    
       member   m     pointer p                       integer n
       argument a     reference r                     short   n
       local    l                                     float   f
                                                      double  f
                                                      boolean b
    

    So...

    int A::methodCall(float af_Argument1, int* apn_Arg2)
    {
        lpn_Temp = apn_Arg2;
        mpf_Oops = lpn_Temp;  // Here I can see I made a mistake, I should not assign an int* to a float*
    }
    

    Take it for what's it worth.

提交回复
热议问题