Skip to content

Fix or disable conversion warnings? #84

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

Closed
theuni opened this issue Apr 26, 2024 · 2 comments · Fixed by #85
Closed

Fix or disable conversion warnings? #84

theuni opened this issue Apr 26, 2024 · 2 comments · Fixed by #85

Comments

@theuni
Copy link
Contributor

theuni commented Apr 26, 2024

By default, Xcode adds warnings for implicit conversions that lose precision like:
Implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int')

Noticed when testing the XCode output of #75. There are 10 instances of this and it's pretty annoying in the build logs.

For example:

size_t ComputeCapacity(uint32_t bits, size_t max_elements, uint32_t fpbits) {
    if (bits == 0) return 0;
    uint64_t base_fpbits = BaseFPBits(bits, max_elements);

Is there any interest in cleaning these up? Or would it be preferred to disable them with -Wconversion ?

@sipa
Copy link
Collaborator

sipa commented Apr 26, 2024

I'm ok with adding explicit conversions to avoid these.

@theuni
Copy link
Contributor Author

theuni commented Apr 26, 2024

Quick naive fixes here. Want me to clean them up and PR?

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 a pull request may close this issue.

2 participants