Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upEncourage fixed-size integer #16446
Comments
This comment has been minimized.
This comment has been minimized.
|
cc #11831 |
This comment has been minimized.
This comment has been minimized.
Can you be more specific? I also feel like #15526 is related, this may just be a superset of that issue. |
This comment has been minimized.
This comment has been minimized.
|
The documentations (i.e. tutorial, guide…) part is definitely #15526. The strict rule about removing |
thestinger
added
the
A-docs
label
Aug 15, 2014
This comment has been minimized.
This comment has been minimized.
|
I don't think the suffixes should be removed. Fixed-size integers are a better choice for anything not being used for sizes / indexing, but I have a feeling that the most common case is tied to container lengths. I didn't like the fallback because it was prone to causing mistakes, but I don't think we should go out of the way to make things more painful. |
This comment has been minimized.
This comment has been minimized.
|
Currently the documentation teaches new users to use |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
cc #16736 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
cc #14758 |
This comment has been minimized.
This comment has been minimized.
|
@thestinger, could you please change the label for "metabug" (if appropriate)? |
This comment has been minimized.
This comment has been minimized.
l0kod
referenced this issue
Sep 6, 2014
Closed
Rust to_int() and related method do not check for overflow #4
This comment has been minimized.
This comment has been minimized.
|
Some |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Other |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Another related bug: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Integer overflow bug: |
This comment has been minimized.
This comment has been minimized.
|
@l0kod #17795 doesn't seem to be caused by the names/sizes/conventions of integers in Rust. At some point in the past |
This comment has been minimized.
This comment has been minimized.
|
We've gone through and made a lot of changes related to this, and so I'm gonna give it a close. If we find anything else, it should also be fixed. |
l0kod commentedAug 12, 2014
The #6023 force to use a type suffix for integers. As discussed in rust-lang/rfcs#115 and #9940, the
intanduintshould only be used for memory-related values (e.g. length).The documentations mostly use
isuffix examples. It should encourage the use of fixed-size integer (e.g.u32) for common uses.A more strict rule could be to remove the
uandifrom allowed suffixes, but to rely on full explicit typing (e.g.: int) when really needed.This could be annoying for
range-like functions but it's not that burdensome to use the explicit generic typing (e.g.range::<uint>(0, 5)).