February 06, 2014 [Issue 12088] New: Bugs caused by using logical 'and' instead of bitwise 'and' | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=12088 Summary: Bugs caused by using logical 'and' instead of bitwise 'and' Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2014-02-06 02:33:12 PST --- This is not an enhancement request, it shows a language small design problem. D gives no warnings nor errors on this code: void main() { uint x; ubyte y = (x >> 16) && 0xFF; } Here to extract a ubyte the programmer has used a logical 'and' instead of a bitwise 'and' by mistake. And it's not an uncommon mistake. Ideas to face this kind of bugs are welcome. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation