-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Use fixed width integers (at least in ABI) #343
Comments
Some interesting food for thought: https://stackoverflow.com/a/13424208/321302. tl;dr: below is an interesting example. The question this brings is whether the fixed with integers do really provide such portability guarantees that we can reliably support mixing of outputs of compilers that use different widths for
|
We discussed this in the monthly call. It seems the consensus is to use specific types: int32_t, int64_t, ssize_t, and so on. |
I've merged the PR that uses fixed-width integers in the ABI instead of I'm reopening this issue because I'm working on a change that uses a fixed-width for |
I'm closing this issue since this is basically done except of the |
What is the thinking w.r.t. types such as
int
,long
, which can vary in size even between different compilers even on the same system? Shouldn't the ABI be defined in terms of unambiguous fixed width types such asint32_t
?The question is then what the API should expose. I am not sure if switching everything to fixed width integers would be good porting experience, maybe it's fine? Without switching to fixed width integers in user code, people would see compiler warnings for conversions if they use (with
-Wconversion
), but maybe that's a good thing and it would guide them to fix them.Alternative: the API can still expose generic
int
etc. and the trampolines would do the conversions, but then what if the ABI result does not fit into the API type (i.e., ABI returnsint32_t
, API returnsint
andsizeof(int) == 16
for some compiler). We could fail at compilation time in such situation.Example of the conversion warnings:
The text was updated successfully, but these errors were encountered: