Why isn't this expression const?

Brian Palmer d at brian.codekitchen.net
Wed May 9 18:46:08 PDT 2007


Frits van Bommel Wrote:

> Silverling wrote:
> > Brian Palmer Wrote:
> > 
> >> ...
> 
> I can't get it to compile for ints either...

Sorry, now that I read what I wrote I wasn't clear. I didn't mean changing float to int, I meant doing:

 const int a = 5;
 const int b = a*-1;

works as expected.

> 
> > Try
> > const Vector3 ROT_FORCE_CCW = [0, 400_000, 0];
> > const Vector3 ROT_FORCE_CW  = [0, ROT_FORCE_CCW.y*-1, 0];
> > 
> > That's how you init an array. I assume that Vector3 is an alias for float[3].
> 
> It's not an array. Look at the first line of his code: it's a struct.

Yes, thanks.



More information about the Digitalmars-d-learn mailing list