-
Notifications
You must be signed in to change notification settings - Fork 261
POC: use stdbool #2734
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
POC: use stdbool #2734
Conversation
| typedef int avifBool; | ||
| #define AVIF_TRUE 1 | ||
| #define AVIF_FALSE 0 | ||
| typedef bool avifBool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For backward compatibility, we can't make this change because int and bool have different sizes. Here is an experiment with Clang on Linux:
$ cat bool.c
#include <stdbool.h>
#include <stdio.h>
int main(void) {
printf("sizeof(int) = %zu\n", sizeof(int));
printf("sizeof(bool) = %zu\n", sizeof(bool));
return 0;
}
$ clang --version
Debian clang version 19.1.7 (1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
$ clang -Weverything bool.c
$ ./a.out
sizeof(int) = 4
sizeof(bool) = 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, there is an ABI breakage, that was more a POC. Do we wait for 1.3.0 or we will never allow that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1.3.0 is a minor release, which allows new features but does not allow backward incompatible changes. v2.0.0 is a major release, which allows any changes.
We can either abandon this pull request and make this a conditionally-compiled change that we enable in a CI workflow.
|
This PR is now part of the CI in #2712 |
This breaks the ABI