[Issue 1123] New: We can change Struct.init
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Wed Apr 11 09:06:08 PDT 2007
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=1123
           Summary: We can change Struct.init
           Product: D
           Version: unspecified
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: s180m at yahoo.co.jp
struct Matrix {
  double e = 1.;
  Matrix scale(double r){e*=r;return *this;}
  const Matrix Identity = {10.};
}
void main(){
  for(int i;i<5;i++){
    printf("%f\n",Matrix.Identity.scale(.9).e);
  }
  printf("\n");
  for(int i;i<5;i++){
    printf("%f\n",Matrix.init.scale(.9).e);
  }
}
-----------------
9.000000
8.100000
7.290000
6.561000
5.904900
0.900000
0.810000
0.729000
0.656100
0.590490
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list