Is there any reason why arithmetic operation on shorts and bytes return int?
d coder
dlang.coder at gmail.com
Tue Dec 11 19:09:20 PST 2012
On Wed, Dec 12, 2012 at 3:40 AM, Walter Bright
<newshound2 at digitalmars.com>wrote:
> No worries there :-) I feel pretty dang strongly about this issue, from
> bad experience.
>
> Even if a language behaves "wrong", it is still usable if it is
> predictable.
>
Agreed.
How about this.
1. Let "char" and "short" behave the C/C++ way. These can return integers.
This will make C/C++ code work in D.
2. Make D "byte" operations return bytes. And create another type (named
say dbyte or shortint) and make operations on the new type return
shortints. This will make these types more usable in D code. Well we end up
adding another keyword, but we shall get workable and safe 8-bit and 16-bit
integrals.
Regards
- Puneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121212/0fabcf1e/attachment.html>
More information about the Digitalmars-d
mailing list