-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Return types varing between different target platforms should be unified #10645
Comments
Since #10580, the return type of The unbuffered methods are not directly affected, because |
@straight-shoota Good idea! Just running it without modifications produces this: ( +++ b/src/big/big_float.cr
@@ -85,7 +85,7 @@ struct BigFloat < Float
# TODO: improve this
def_hash to_f64
- def self.default_precision : UInt64
+ def self.default_precision : UInt32
LibGMP.mpf_get_default_prec
end
@@ -193,7 +193,7 @@ struct BigFloat < Float
BigInt.new { |mpz| LibGMP.set_f(mpz, mpf) }
end
- def to_i64 : Int64
+ def to_i64 : Int32
LibGMP.mpf_get_si(self)
end
@@ -233,7 +233,7 @@ struct BigFloat < Float
LibGMP.mpf_get_si(self)
end
- def to_u64 : UInt64
+ def to_u64 : UInt32
raise OverflowError.new if self < 0
LibGMP.mpf_get_ui(self)
end
diff --git a/src/pointer.cr b/src/pointer.cr
index d65811a69..eaf4e8eb5 100644
--- a/src/pointer.cr
+++ b/src/pointer.cr
@@ -452,7 +452,7 @@ struct Pointer(T)
# ptr[0] # => 42
# ptr[1] # => 42
# ```
- def self.malloc(size : Int, value : T) : Int64*
+ def self.malloc(size : Int, value : T) : UInt32*
ptr = Pointer(T).malloc(size)
size.times { |i| ptr[i] = value }
ptr
diff --git a/src/yaml/pull_parser.cr b/src/yaml/pull_parser.cr
index 630352869..b9e190dea 100644
--- a/src/yaml/pull_parser.cr
+++ b/src/yaml/pull_parser.cr
@@ -260,7 +260,7 @@ class YAML::PullParser
# Note: YAML starts counting from 0, we want to count from 1
- def location : {UInt64, UInt64}
+ def location : {UInt32, UInt32}
{start_line, start_column}
end
(the |
I can confirm that it's broken. But actually that would be totally preventable! Why don't we just add such a build in CI: |
Yeah, #7587 got kind of burried 🙈 |
The return types of
I found some others:
|
Bug Report
Different types returned on different arch's for File#pos
Minimal test case:
For 64-bit Darwin it's built without any options with
shards build
For 32-bit Linux it's cross-compiled on Darwin and linked inside armv6 docker container:
It boils down to
LibC.lseek
return type:crystal/src/crystal/system/unix/file_descriptor.cr
Line 83 in dd40a24
crystal/src/io/file_descriptor.cr
Line 119 in dd40a24
And it seems like there is other places where arch-dependent types are exposed from LibC:
.pread
crystal/src/file/preader.cr
Line 22 in dd40a24
crystal/src/crystal/system/unix/file_descriptor.cr
Line 156 in dd40a24
Possibly #unbuffered_read & #unbuffured_write (implicit return value with bytes read/written?)
crystal/src/crystal/system/unix/file_descriptor.cr
Line 12 in dd40a24
The text was updated successfully, but these errors were encountered: