Hi Darkside,

darkside <[EMAIL PROTECTED]> wrote:
> 
> I think I found a bug in Lejos 3.0 (M3, or whatever the current download
> is).  If I add 2 shorts, the returned type is int.
> 
> To demonstrate:
> 
> short a = 1, b = 1;
> short c = a + b; // this doesn't compile
> 
> short d = (short)(a + b); // this compiles

> Or is this somehow intended?  Is there some sense to returning an int
> that I'm not aware of?

this is standard Java, the arithmetic operations always operate
on int or long, so when you write a + b the operands are converted
silently to int and the result is also an int, which you have
to cast down to assign it to a short variable.

BTW, the Java Puzzlers book is great to learn these intricacies.

> I'm posting here because I can't seem to find a bug
> tracker on your project page

This is perfectly fine, I prefer bugs posted here to bugs sitting
unnoticed for ages in the bug tracker, therefore I disabled it.


Cheers

Jürgen

-- 
Jürgen Stuber <[EMAIL PROTECTED]>
http://www.jstuber.net/
gnupg key fingerprint = 2767 CA3C 5680 58BA 9A91  23D9 BED6 9A7A AF9E 68B4


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Lejos-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lejos-discussion

Reply via email to