Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 259: Error on unsafe signed/unsigned comparisons. #444

Merged
merged 1 commit into from
Nov 25, 2011

Conversation

ckamm
Copy link

@ckamm ckamm commented Oct 10, 2011

Fixes http://d.puremagic.com/issues/show_bug.cgi?id=259 in a way that uses the range propagation of expressions. It is also still backwards compatible with C code, though some C code may now produce an error. It still breaks lots of existing code though.

Examples:

uint a = 3;
if (a > 4) {} // ok

uint b = 3;
if (b > -2) {} // now an error

byte c = -67;
uint u;
if (u < c + 0x100) {} // ok

int[] a;
for (int i = 0; i < a.length; ++i) {} // error, ugh

WalterBright added a commit that referenced this pull request Nov 25, 2011
Bug 259: Error on unsafe signed/unsigned comparisons.
@WalterBright WalterBright merged commit 4536fd5 into dlang:master Nov 25, 2011
@WalterBright
Copy link
Member

This is clever and I like it. But it does break a lot of code left and right, and perhaps that code is broken. I'm going to leave it in #ifdef'd out for the moment.

braddr pushed a commit to braddr/dmd that referenced this pull request Oct 22, 2012
@denis-sh
Copy link
Contributor

denis-sh commented Mar 5, 2013

I'm going to leave it in #ifdef'd out for the moment.

#ifdef'd code now completely removed from expression.c in 8f7b3b0 (see diff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants