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
Note that there are no implicit conversions (except to_unsafe, which is explained later) when invoking a C function: you must pass the exact type that is expected. For integers and floats you can use the various to_... methods.
More surprising is that it is okay to pass a BigInt here too, but not its unsafe counterpart:
require"big"LibC.exit(69.to_big_i) # okayLibC.exit(69.to_big_i.to_unsafe) # Error: argument 'x0' of 'LibC#exit' must be Int32, not Pointer(LibGMP::MPZ)
So something else must be going on.
The text was updated successfully, but these errors were encountered:
Yes, on fun calls, the compiler applies some special conversions for numeric parameters. If the argument responds to #to_i32!, this methods return value is used.
The docs say:
But this is not true:
More surprising is that it is okay to pass a
BigInt
here too, but not its unsafe counterpart:So something else must be going on.
The text was updated successfully, but these errors were encountered: