[ nice-Bugs-797569 ] byte var wraps - no runtime error
"SourceForge.net" <[email protected]>
| Newsgroups | gmane.comp.lang.nice.devel |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #797569, was opened at 2003-08-29 15:24
Message generated for change (Comment added) made by igouy
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=797569&group_id=12788
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Isaac Gouy (igouy)
Assigned to: Nobody/Anonymous (nobody)
Summary: byte var wraps - no runtime error
Initial Comment:
>> Looks like you found a bug in the code generation.
>> The incrementation should typecheck, but the value
>> should wrap.
> This is now fixed.
Using the development nice.jar
the loop never terminates, I think because i is a byte
value which wraps rather than an int.
I guess this error will go away with the "special rule" for
type inference on integer types.
In these circumstances would it be better to raise an
exception at runtime, rather than silently continue?
void main(String[] args){
var count = 0;
for (var i=0; i<10000; i++) count++;
println(count);
}
----------------------------------------------------------------------
>Comment By: Isaac Gouy (igouy)
Date: 2003-08-29 17:03
Message:
Logged In: YES
user_id=536291
>I don't see that as an urgency when
I hope my approach of reporting whatever seems like a bug is
OK with you guys ;-) I don't believe I'm smart enough to
figure out the other circumstances in which the problem
might occur - so I just try to report what seems to happen.
----------------------------------------------------------------------
Comment By: Arjan Boeijink (arjanb)
Date: 2003-08-29 16:03
Message:
Logged In: YES
user_id=688815
>the loop never terminates, I think because i is a byte
>value which wraps rather than an int.
indeed
>I guess this error will go away with the "special rule" for
>type inference on integer types.
Yes
>In these circumstances would it be better to raise an
>exception at runtime, rather than silently continue?
That's a possibility and/or it could be checked that a byte is
compared with 10000.
But I don't see that as an urgency when the inference for
integer literals has changed because it will almost never
happen in code that doesn't use inference.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=797569&group_id=12788
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf