-
Notifications
You must be signed in to change notification settings - Fork 312
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
refactor(macro): Use CHECK to replace dassert_f/dassert #1205
Conversation
5671914
to
6d4fe80
Compare
@@ -369,7 +368,7 @@ void redis_parser::reply_all_ready() | |||
std::vector<dsn::message_ex *> ready_responses; | |||
fetch_and_dequeue_messages(ready_responses, true); | |||
for (dsn::message_ex *m : ready_responses) { | |||
dassert(m != nullptr, ""); | |||
CHECK(m, ""); |
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.
It's better to user m != nullptr
for pointer
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.
Both are OK.
But in the future refactor, we are going to introduce CHECK_EQ
and CHECK_NE
, it's a bit of duplicate and strange if we judge the pointer like CHECK_NE(pointer, nullptr)
. I also consulted some other projects' habit, both styles are OK.
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.
Added a new macro CHECK_NOTNULL
for pointers, similar to glog CHECK_NOTNULL
e089308
to
8317629
Compare
#1204
CHECK
CHECK_NOTNULL
CHECK
to replace part ofdassert_f
, which are used to check a single conditionCHECK
to replace part ofdassert
, which are used to check a single condition. And update to usefmt
styleTODO: src/replica/mutation_log.cpp:970 should be fixed later