D - [Bug] e2ir: cannot cast from bit to byte
- Manfred Nowak <svv1999 hotmail.com> Jan 22 2004
- J Anderson <REMOVEanderson badmama.com.au> Jan 22 2004
- J C Calvarese <jcc7 cox.net> Jan 23 2004
- Manfred Nowak <svv1999 hotmail.com> Jan 24 2004
<code>
void main()
{
bit bi;
byte by;
by=bi;
}
</code>
This is generated in the coding phase.
So long.
--
Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/
2EA56D6D4DC41ABA311615946D3248A1
Jan 22 2004
Manfred Nowak wrote:<code> void main() { bit bi; byte by; by=bi; } </code> This is generated in the coding phase. So long.
bits to an array of bytes but the above code probably doesn't make much sense. BTW: You can always go: by=(bi)?1:0; -- -Anderson: http://badmama.com.au/~anderson/
Jan 22 2004
J Anderson wrote:Manfred Nowak wrote:<code> void main() { bit bi; byte by; by=bi; } </code> This is generated in the coding phase. So long.
bits to an array of bytes but the above code probably doesn't make much sense. BTW: You can always go: by=(bi)?1:0;
This probably a dumb question, but does anyone know what does e2ir mean? Since the error message includes a line number and a description, I can't complain, but I am curious what "e2ir" means. -- Justin http://jcc_7.tripod.com/d/
Jan 23 2004
J Anderson wrote:This is by-design.
Where to find that in the docs? I only found: | Usual Arithmetic Conversions [...] | 5. Else the integer promotions are done on each operand, followed by: | 1. If both are the same type, no more conversions are done. | 2. If both are signed or both are unsigned, the smaller type is | converted to the larger. | 3. If the signed type is larger than the unsigned type, the | unsigned type is converted to the signed type. Consequently dmd is able to convert bit to anything else than byte. The following code compiles(!): <code> void main(){ bit bi=true; ubyte r0=bi; short r1=bi; ushort r2=bi; int r3=bi; uint r4=bi; long r5=bi; ulong r6=bi; float r7=bi; double r8=bi; real r9=bi; char r10=bi; dchar r11=bi; wchar r12=bi; } </code> [...] | the above code probably doesn't make much sense. It is stripped off code, as required by walter. :-) So long. -- Fight Spam! Join EuroCAUCE: http://www.euro.cauce.org/ 2EA56D6D4DC41ABA311615946D3248A1
Jan 24 2004









J C Calvarese <jcc7 cox.net> 