Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix machine type equality #1376

Closed
boggle opened this issue Dec 22, 2011 · 4 comments
Closed

fix machine type equality #1376

boggle opened this issue Dec 22, 2011 · 4 comments

Comments

@boggle
Copy link
Contributor

boggle commented Dec 22, 2011

float, int, uint should be equal to their machine type equivalents. This is currently not the case and originally was the reason for the introduction of trivial casts. Now that these are gone, this needs fixing, i.e.

let f: float = fXY::sin(1.0)

should compile.

@brson
Copy link
Contributor

brson commented Dec 22, 2011

If we do this then the line let i: int = 0i32 would compile on 32-bit platforms but not on 64-bit platforms. This strikes me as undesirable.

@boggle
Copy link
Contributor Author

boggle commented Dec 22, 2011

Yes, i can see this issue. On the other hand it stops me from exporting core::f64|f32 math as core::float depending on architecture.

I'm not vested in any particular solution to this as long as there is one.

@graydon
Copy link
Contributor

graydon commented Dec 22, 2011

brson: that risk is already present with declarations like let i : int = 0x1000_0000_0000_0000;, it'll compile on x64 but not x86. This is the inherent meaning of using int or float: "please make the following code at least slightly platform-specific"

@boggle
Copy link
Contributor Author

boggle commented Dec 22, 2011

We agreed to go for this now, unless strong objections are raised.

bjorn3 added a commit to bjorn3/rust that referenced this issue Jun 15, 2023
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants