[Issue 6949] no warning or error if unsigned variable is compared to 0
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 30 04:43:27 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6949
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|pull |
AssignedTo|andrej.mitrovich at gmail.com |nobody at puremagic.com
--- Comment #13 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2012-11-30 04:43:25 PST ---
(In reply to comment #12)
> Regarding a comment by Don, is it possible to generate a warning/error only in
> foo() and not in bar()?
>
>
> void foo(uint x) {
> if (x < 0) {} // error or warning here
> }
> void bar(T)(T x) {
> if (x < 0) {} // OK
> }
> void main() {
> foo(5U);
> bar(5U);
> }
I doubt it. Anyway I've closed the pull for now since it's controversial when
(or if) we should have warnings/errors for this.
If we had a switch like GCC's `-Wtype-limits` then we could implement this
check for all cases when the switch is enabled and not worry about it. But
Walter is against switches so...
Maybe LDC/GDC can or already do support this though.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list