Skip to content

Conversation

@vrabaud
Copy link
Contributor

@vrabaud vrabaud commented Apr 1, 2025

This breaks the ABI

typedef int avifBool;
#define AVIF_TRUE 1
#define AVIF_FALSE 0
typedef bool avifBool;
Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

@vrabaud vrabaud changed the title Use stdbool POC: use stdbool Apr 2, 2025
@vrabaud
Copy link
Contributor Author

vrabaud commented Apr 4, 2025

This PR is now part of the CI in #2712

@vrabaud vrabaud closed this Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants