-
Notifications
You must be signed in to change notification settings - Fork 254
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
size_t
is translated to libc::c_ulong
instead of libc::size_t
#870
Comments
I've seen this apply to inline casts as well, where you end up with: ::core::mem::size_of::<libc::c_uint>() as libc::c_ulong
// or
::core::mem::size_of::<libc::c_uint>() as libc::c_ulong as libc::c_ulonglong Instead of ::core::mem::size_of::<libc::c_uint>() as libc::size_t This seems to be an issue for all integer types, though, where |
I'm trying to figure this issue out. What puzzles me is why the transpiler is "evaluating" the typedef instead of using its name as-is. For standard C library functions like |
I haven't looked at this in a while, but it's probably coming from clang. |
Currently c2rust translates the typedef of
size_t
tounsigned long
in<stdlib.h>
and thus embeds it's size into the type.It could translate
size_t
tolibc::size_t
orusize
which would more directly encode the source, while preserving semantics.As mentioned in #20 many integer types differ across platforms but this does not apply to
size_t
:Presumably any integer typedef named
size_t
is intended to belibc::size_t
, but an option could be provided.For Example:
Translates to:
Instead of:
The text was updated successfully, but these errors were encountered: