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

api: fixed zero producing warnings for primitive types in C++. #330

Merged
merged 1 commit into from Jan 9, 2020

Conversation

@Snaipe
Copy link
Owner

Snaipe commented Jan 4, 2020

We also stop using empty() and ! as a basis for checking for zero-ness,
and instead we simply compare the current parameter with the zero value
of the type. This does requires that the type is default-constructible,
which is, I think, reasonable, because a type that does not have
a default-constructor cannot be guantanteed to define what a
"zero-value" of itself means, if any.

It is probably fine to make that assumption and document it as such, as
the obvious workaround is to cr_assert the appropriate boolean
condition.

@Snaipe Snaipe force-pushed the api/zero-fix branch 2 times, most recently from 96391d9 to 5ad255b Jan 4, 2020
We also stop using empty() and ! as a basis for checking for zero-ness,
and instead we simply compare the current parameter with the zero value
of the type. This does requires that the type is default-constructible,
which is, I think, reasonable, because a type that does not have
a default-constructor cannot be guantanteed to define what a
"zero-value" of itself means, if any.

It is probably fine to make that assumption and document it as such, as
the obvious workaround is to cr_assert the appropriate boolean
condition.
@Snaipe Snaipe force-pushed the api/zero-fix branch from 5ad255b to 965eef7 Jan 5, 2020
@Snaipe Snaipe merged commit 4b5174e into bleeding Jan 9, 2020
6 checks passed
6 checks passed
Alpine (gcc,i386) Task Summary
Details
Alpine (gcc,x86_64) Task Summary
Details
Debian (gcc) Task Summary
Details
FreeBSD Task Summary
Details
MacOS Task Summary
Details
Windows (mingw-gcc) Task Summary
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.