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

Construct Value only from uint32_t/uint64_t #746

Merged
merged 1 commit into from
Mar 3, 2021
Merged

Construct Value only from uint32_t/uint64_t #746

merged 1 commit into from
Mar 3, 2021

Conversation

chfast
Copy link
Collaborator

@chfast chfast commented Mar 2, 2021

This disables Value constructors for unsigned integers for types other
than uint32_t/uint64_t. This requires users to use these types.
This can cause portability issues on macOS/Linux if type like
unsigned long is used. This also helps in 32-bit port.

@chfast chfast requested review from axic and gumb0 March 2, 2021 11:42
@codecov
Copy link

codecov bot commented Mar 2, 2021

Codecov Report

Merging #746 (db583c4) into master (0c663e4) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #746      +/-   ##
==========================================
- Coverage   99.26%   99.26%   -0.01%     
==========================================
  Files          74       74              
  Lines       11442    11439       -3     
==========================================
- Hits        11358    11355       -3     
  Misses         84       84              
Flag Coverage Δ
rust 99.86% <ø> (ø)
spectests 90.68% <100.00%> (ø)
unittests 99.22% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/fizzy/value.hpp 100.00% <100.00%> (ø)
test/unittests/value_test.cpp 100.00% <100.00%> (ø)

@@ -26,11 +26,10 @@ union Value
/// We need to support {signed,unsigned} x {32,64} integers. However, due to uint64_t being
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is outdated.

Comment on lines 27 to 28
/// Some issues are expected when uint64_t is not unsigned long.
/// Then Value cannot be constructed out of unsigned long literals.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"some issues" sounds a bit confusing to me, maybe this:

Suggested change
/// Some issues are expected when uint64_t is not unsigned long.
/// Then Value cannot be constructed out of unsigned long literals.
/// On the platforms where uint64_t is not unsigned long, it is expected that
/// Value cannot be constructed out of unsigned long literals.

This disables Value constructors for unsigned integers for types other
than uint32_t/uint64_t. This requires users to use these types.
This can cause portability issues on macOS/Linux if type like
unsigned long is used. This also helps in 32-bit port.
@chfast chfast merged commit 56ffca7 into master Mar 3, 2021
@chfast chfast deleted the value branch March 3, 2021 16:03
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.

3 participants