You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This testcase seems to show that negative numbers can be accepted as unsigned integers. Unsigned integers should only comprise of non-negative numbers.
This is correct behavior. The "as" operator performs a cast. "-1" is an int, and "as uint" casts it to uint. The logging system that displays "-1" and "0xffffffff" simply doesn't know enough to differentiate int and uint, so it displays both. Limitation of the logging system.
kazcw
pushed a commit
to kazcw/rust
that referenced
this issue
Oct 23, 2018
This testcase seems to show that negative numbers can be accepted as unsigned integers. Unsigned integers should only comprise of non-negative numbers.
(not sure if this is working as intended.)
On repository revision 5955e23 on Mac 10.6.5.
Output:
$ ./rustboot -L . -o 2out.out 2test.rs
$ ./2out.out
rt: ---
rt: a5ed:main:main: rust: -1 (0xffffffff)
The text was updated successfully, but these errors were encountered: