digitalmars.D.bugs - A uint type bit shift error
- Hiroshi Sakurai (16/17) Dec 28 2004 Hi.
- Thomas Kuehne (11/11) Dec 29 2004 -----BEGIN PGP SIGNED MESSAGE-----
- Jarrett Billingsley (6/6) Dec 31 2004 I noticed this too. Sometimes it'll say something like "Cannot convert
- Walter (6/18) Mar 09 2005 uint
Hi. An error occurs in following codes at the time of compile. It checked with the Windows version compiler v0.109. test.d int main() { uint a; a = 1 << 31; printf("%d\n", a); return 0; }dmd test.dtest.d(4): cannot implicitly convert expression 1 << 31 of type int to uint Thanks, Hiroshi Sakurai --------------------------------- Japanese D wiki BugTrack http://f17.aaa.livedoor.jp/~labamba/?BugTrackhttp://f17.aaa.livedoor.jp/~labamba/?BugTrack%2F10
Dec 28 2004
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Added to DStress as http://dstress.kuehne.cn/run/cast_06.d http://dstress.kuehne.cn/run/cast_07.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB0zZ+3w+/yD4P9tIRArRjAJ9XoRk9VEaX71bkXwwMmAnqtPNKrgCeKjbH gBNaFTimOunP/U9v1aRnoWE= =D4K0 -----END PGP SIGNATURE-----
Dec 29 2004
I noticed this too. Sometimes it'll say something like "Cannot convert 0xfffffffff093850a to uint", which leads me to believe that it's interpreting the constant as a long (64-bit int). The 0.105 changelog says " Changed integral literal type determination to match C99 6.4.4.1." Would be interesting to see if the bug is in 0.104 or 0.105 (I missed the DMD downloads for 0.103 through 0.108).
Dec 31 2004
"Hiroshi Sakurai" <Hiroshi_member pathlink.com> wrote in message news:cqtmid$3no$1 digitaldaemon.com...Hi. An error occurs in following codes at the time of compile. It checked with the Windows version compiler v0.109. test.d int main() { uint a; a = 1 << 31; printf("%d\n", a); return 0; }uint That's right. The sign change changes the meaning, hence the message. I suggest rewriting to: 1u << 31dmd test.dtest.d(4): cannot implicitly convert expression 1 << 31 of type int to
Mar 09 2005