why ; ?

Michael Neumann mneumann at ntecs.de
Thu May 8 10:24:54 PDT 2008


terranium wrote:
 > Michael Neumann Wrote:
 >
 >> Another example which leads to hard to read code and potential
 >> bugs is (ignoring compiler warnings):
 >>
 >>      class A
 >>      {
 >>        int i;
 >>
 >>        //
 >>        // add some 25 lines of code here
 >>        //
 >>
 >>        void foo(int i)
 >>        {
 >>          // what is "i" here?
 >>        }
 >>      }
 >>
 >> This is solved in Ruby by using a separate namespace for instance
 >> variables ("@i" for instance variable "i", and "i" for local variable
 >> "i").
 >
 > In C family languages this is ruled out by naming convention.

Which in the case of using a m_ prefix leads to hard(er) to read code.
And then there is no standard naming convention, and who actually uses
such a naming convention? Without that, you can't easily distinguish a
local variable from an instance variable from a global variable.

Regards,

   Michael



More information about the Digitalmars-d mailing list