www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - strange bug

reply Tiago Gasiba <tiago.gasiba gmail.com> writes:
The following code produces an error message, but it should not (DMD v0.140 -
Linux):

int main(){
  int    a,b,c;
  double x;

//  a = cast(int)(  b *x );
  a = cast(int)( (b)*x );
}

Best,
Tiago

-- 
Tiago Gasiba (M.Sc.) - http://www.gasiba.de
Everything should be made as simple as possible, but not simpler.
Nov 28 2005
parent Derek Parnell <derek psych.ward> writes:
On Mon, 28 Nov 2005 11:22:57 +0100, Tiago Gasiba wrote:

 The following code produces an error message, but it should not (DMD v0.140 -
Linux):
 
 int main(){
   int    a,b,c;
   double x;
 
 //  a = cast(int)(  b *x );
   a = cast(int)( (b)*x );
 }
 
 Best,
 Tiago
I'm going from memory here, but I think that Walter views syntax in the form ( identifier ) as bad form or at least a waste, and as it also looks like a C style cast, he decided to outlaw it. However, it's not very consistent because this next line compiles ... a = cast(int)( ((b))*x ); So the upshot is if you ever find yourself needing ( identifier ) code it as (( identifier )) and it'll work. -- Derek Parnell Melbourne, Australia 29/11/2005 12:39:03 AM
Nov 28 2005