Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Dec 2004 12:26:03 +0000
From:      Pete French <petefrench@ticketswitch.com>
To:        ertr1013@student.uu.se, petefrench@ticketswitch.com
Cc:        colin.percival@wadham.ox.ac.uk
Subject:   Re: Will there be a 5.3.1?
Message-ID:  <E1Ch5Z5-000FuI-TV@dilbert.firstcallgroup.co.uk>
In-Reply-To: <20041221192924.GA27658@falcon.midgard.homeip.net>

next in thread | previous in thread | raw e-mail | index | archive | help
> Buggy compilers are indefensible, yes, but why try to apologise for it?

I dont see it as a bug. Without an 'L' the right hand side of that
expression is a 16 bit int. For which 65536 is out of range. If I
wrote 'int y = 65535; long x = y;' then I would get the same result for
the same reason.

The correct line is 'long x = 65535L;' which specifies that the constant
is a long. In fact aren't situations like this the precise reason for
having the 'L' as part of the language ?

> 'long x = 65535;' will not set x to -1, even with 16-bit ints.

It will and does on certain compilers unfortunately.

-pcf.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1Ch5Z5-000FuI-TV>