D - Compile error in assignment to bit field
- larry cowan (9/9) Feb 04 2004 const bit mySwitch = true;
- Manfred Nowak (8/10) Feb 05 2004 Confirmed.
- Larry Cowan (11/19) Feb 07 2004 Note: I think there are 2 problems here:
const bit mySwitch = true; const bit[] mySwitches = [ true, false, false, true ]; int main() { mySwitch = false; // "test.d(6): '1' is not an lvalue" mySwitches[1] = true; // compiles ok return 0; } Same with v.77 and v.79
Feb 04 2004
larry cowan wrote:const bit[] mySwitches = [ true, false, false, true ]; mySwitches[1] = true; // compiles okConfirmed. Moreover: | mySwitches[4] = true; // also compiles ok And: | printf("%u\n", myswitches[4]); compiles also, however gives bounds checking error at runtime.
Feb 05 2004
Note: I think there are 2 problems here: 1. The message "test.d(6): '1' is not an lvalue" is understandable (const mySwitch has already been equated to true = 1), but not very apropos. 2. Allowing me to change const mySwitches array entries shouldn't be allowed should it?, or do I have to "const" each entry somehow? HELP! "larry cowan" <larry_member pathlink.com> modified his message news:bvs11e$1oc$1 digitaldaemon.com...const bit mySwitch = true; const bit[] mySwitches = [ true, false, false, true ]; int main() {// mySwitch = false; // "test.d(6): '1' is not an lvalue", if compile attemptedmySwitches[1] = true; // compiles okassert(mySwitches[1]); // succeedsreturn 0; } Same with v.77 and v.79
Feb 07 2004