var.init change

Chris Miller chris at dprogramming.com
Sun Sep 9 08:01:47 PDT 2007


By the way, I don't think this is a valid argument against the old  
var.init:

    int x = 42;
    void foo(inout int x)
    {
       // x.init != 42
    }

The var.init just doesn't apply to parameters; just Type.init does. It  
especially doesn't apply when you use the updated var.init feature request  
where it errors if it's a runtime initializer; for parameters it's always  
runtime (setting aside the new static ones or templates).

I very much love and miss the old var.init. It's so much simpler to  
compare and reset variables with their initial values using the old  
var.init, not having to define separate constants for something the  
compiler can remember (and used to just fine).



More information about the Digitalmars-d mailing list