D - Compiler bug? Assigning to an array...
- ssuukk (9/9) Dec 18 2003 Don't know if it's compiler bug, or my bug, but according to manual this...
- ssuukk (21/21) Dec 18 2003 Don't know if it's compiler bug, or my bug, but according to manual this
- Robert (11/32) Dec 18 2003 This may work.
- ssuukk (3/11) Dec 18 2003 Thx. It may work. I will check that as soon as someone helps me with
- Sean L. Palmer (10/19) Dec 18 2003 I don't think it has anything to do with the union. Array operations ar...
Don't know if it's compiler bug, or my bug, but according to manual this should work: s[] = 3; // set all array elements to 3 But this crashes the compiler: void identity(){ (*this)[]=0; // rest of code - not important } Any idea how to do it properly (except for loop)?
Dec 18 2003
Don't know if it's compiler bug, or my bug, but according to manual this should work: s[] = 3; // set all array elements to 3 But this crashes the compiler: void identity(){ (*this)[]=0; // rest of code - not important } Any idea how to do it properly (except for loop)? and the struct is defined as: struct frMatrix4 { union { struct { frReal f11, f12, f13, f14, f21, f22, f23, f24, f31, f32, f33, f34, f41, f42, f43, f44; }; frReal[16] f1; frReal[4][4] f2; }; ... I realise that this union may be the problem...
Dec 18 2003
This may work. struct frMatrix4 { void identity() { f1[] = 0; } } But, union with struct has a bug. I posted the problem some time ago. http://www.digitalmars.com/drn-bin/wwwnews?D/19978 "ssuukk" <ssuukk .go2.pl> wrote in message news:brs0eq$2n4b$2 digitaldaemon.com...Don't know if it's compiler bug, or my bug, but according to manual this should work: s[] = 3; // set all array elements to 3 But this crashes the compiler: void identity(){ (*this)[]=0; // rest of code - not important } Any idea how to do it properly (except for loop)? and the struct is defined as: struct frMatrix4 { union { struct { frReal f11, f12, f13, f14, f21, f22, f23, f24, f31, f32, f33, f34, f41, f42, f43, f44; }; frReal[16] f1; frReal[4][4] f2; }; ... I realise that this union may be the problem...
Dec 18 2003
Robert wrote:This may work. struct frMatrix4 { void identity() { f1[] = 0; } }Thx. It may work. I will check that as soon as someone helps me with struct-static-pseudo-constructor problem :-)
Dec 18 2003
I don't think it has anything to do with the union. Array operations are a currently unimplemented feature. You can't do a[] = b[] + c[] * d either. (Walter, don't you think it's about time to go ahead and get this feature working? I assume you intend to before v1.0... it is likely to have some impact on the language as we find situations that cause problems, so it's good to get it out of the way sooner rather than later. Plus it's tres useful, and will provide good parallelization opportunities.) Sean "ssuukk" <ssuukk .go2.pl> wrote in message news:brs09m$2n4b$1 digitaldaemon.com...Don't know if it's compiler bug, or my bug, but according to manual this should work: s[] = 3; // set all array elements to 3 But this crashes the compiler: void identity(){ (*this)[]=0; // rest of code - not important } Any idea how to do it properly (except for loop)?
Dec 18 2003