November 28, 2005 strange bug | ||||
---|---|---|---|---|
| ||||
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.
|
November 28, 2005 Re: strange bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Tiago Gasiba | 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 |
Copyright © 1999-2021 by the D Language Foundation