Skip to content
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

warnings emitted by msvc #11

Closed
Tisten opened this issue Oct 24, 2022 · 4 comments
Closed

warnings emitted by msvc #11

Tisten opened this issue Oct 24, 2022 · 4 comments

Comments

@Tisten
Copy link

Tisten commented Oct 24, 2022

When compiling with MSVC I'm getting warnings:
jeaiii_to_text.h(147): warning C4305: '/=': truncation from 'jeaiii::u32' to 'U'
jeaiii_to_text.h(209): warning C4305: '/=': truncation from 'jeaiii::u32' to 'U'

Replacing

n /= u32(1e8);

by

n = U(n /u32(1e8));

solves it.

@jeaiii
Copy link
Owner

jeaiii commented Oct 27, 2022

does n /= U(1e8); fix it too?

@Tisten
Copy link
Author

Tisten commented Oct 27, 2022

Well, 1e8 doesn't fit in uint8_t so you will get non-working code and these instead:
warning C4310: cast truncates constant value
warning C4723: potential divide by 0

@jeaiii
Copy link
Owner

jeaiii commented Oct 28, 2022

ah, because the MSVC compiler didn't realize that n can't be a uint8_t at that point in the code...okay

@jeaiii
Copy link
Owner

jeaiii commented Oct 30, 2022

clean to warning level 4
ebde9d3

@jeaiii jeaiii closed this as completed Oct 30, 2022
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

No branches or pull requests

2 participants