D - [Bug] e2ir: cannot cast from bit to byte
-
Manfred Nowak
(13/13)
Jan 22 2004
- J Anderson (9/20) Jan 22 2004 This is by-design. I would like the possibility to convert an array of
- J C Calvarese (7/33) Jan 23 2004 This probably a dumb question, but does anyone know what does e2ir mean?
- Manfred Nowak (40/41) 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.This is by-design. I would like the possibility to convert an array of 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: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/<code> void main() { bit bi; byte by; by=bi; } </code> This is generated in the coding phase. So long.This is by-design. I would like the possibility to convert an array of 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;
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