Treating the abusive unsigned syndrome

Sean Kelly sean at invisibleduck.org
Tue Nov 25 14:06:08 PST 2008


== Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
> (You may want to check your system's date, unless of course you traveled
> in time.)
> Russell Lewis wrote:
> > I'm of the opinion that we should make mixed-sign operations a
> > compile-time error.  I know that it would be annoying in some
> > situations, but IMHO it gives you clearer, more reliable code.
> The problem is, it's much more annoying than one might imagine. Even
> array.length - 1 is up for scrutiny. Technically, even array.length + 1
> is a problem because 1 is really a signed int. We could provide
> exceptions for constants, but exceptions are generally not solving the
> core issue.

Perhaps not, but the fact that constants are signed integers has been
mentioned as a problem before.  Would making these polysemous
values help at all?  That seems to be what your proposal is effectively
trying to do anyway.


Sean



More information about the Digitalmars-d mailing list