why ; ?

Bruce Adams tortoise_74 at yeah.who.co.uk
Fri May 9 16:11:54 PDT 2008


On Thu, 08 May 2008 18:24:54 +0100, Michael Neumann <mneumann at ntecs.de>  
wrote:

> 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.
>
Another take (which I prefer) comes from compiler warnings about variables
being shadowed. gcc is good like that.



More information about the Digitalmars-d mailing list