Using stdint instead of int/long#1009
Conversation
9c78536 to
b5bd7e2
Compare
iphydf
left a comment
There was a problem hiding this comment.
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.
iphydf
left a comment
There was a problem hiding this comment.
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.
iphydf
left a comment
There was a problem hiding this comment.
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. |
iphydf
left a comment
There was a problem hiding this comment.
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