-
Notifications
You must be signed in to change notification settings - Fork 283
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
Using stdint instead of int/long #1009
Conversation
9c78536
to
b5bd7e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained
auto_tests/conference_test.c, line 200 at r1 (raw file):
} printf("friends connected, took %d seconds\n", (uint16_t)(time(nullptr) - cur_time));
%d
requires you to pass an int
, exactly that type, no other type. unsigned short
happens to be promoted to int
when passed through varargs, but that's just a pointless conversion/truncation you're doing here. In formatting statements, don't do fixed-size int casts. In all other code, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained
auto_tests/conference_two_test.c, line 23 at r1 (raw file):
TOX_ERR_CONFERENCE_NEW err; tox_conference_new(tox1, &err); ck_assert_msg(err == TOX_ERR_CONFERENCE_NEW_OK, "Failed to create conference 1: %d.", err);
Error messages should start with lowercase and not have a "." at the end, so that they can easily be composed into sentences by error message wrappers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 LGTMs obtained
auto_tests/conference_two_test.c, line 23 at r1 (raw file):
Previously, iphydf wrote…
Error messages should start with lowercase and not have a "." at the end, so that they can easily be composed into sentences by error message wrappers.
We're using this style rule and justification: https://github.com/golang/go/wiki/CodeReviewComments#error-strings
You know, if we want, there is a way to use fixed-width integers in print statements: https://en.cppreference.com/w/cpp/types/integer
might be a bit much though. What do you think @iphydf? |
I think that does not improve readability, so I'd rather avoid those PRI macros. |
566d86e
to
6f813ae
Compare
I did a git rebase and then a git push --force. I think that was correct. Not sure though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 1 of 1 LGTMs obtained
Did my best to surmise the size requirements of these integers, will do the rest of the tests soon. Also added a todo and made an obsessive change to a for loop.
Attempting to use fixed-sized integers as per #974. Only other changes were a todo comment and a functionally nonexistent modification to two for loops.
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)