Leif Hedstrom
2018-11-11 22:44:18 UTC
This might sound petty, but I really much prefer that we consistently put empty lines after local variable declarations. We do so much of the time, but definitely not consistently. Besides looking cleaner, doing this consistently really helps making clang-format not indent code stupidly.
For example, without the empty line we get
if (auto it = g_records_ht.find(name); it != g_records_ht.end()) {
RecRecord *r = it->second;
*buf = (char *)ats_malloc(sizeof(char) * 1024);
Note how clang-format will align the =’s, even though they really aren’t related. Whereas with the empty line, it looks a lot nicer as
if (auto it = g_records_ht.find(name); it != g_records_ht.end()) {
RecRecord *r = it->second;
*buf = (char *)ats_malloc(sizeof(char) * 1024);
My $0.01 of the day.
— Leif
For example, without the empty line we get
if (auto it = g_records_ht.find(name); it != g_records_ht.end()) {
RecRecord *r = it->second;
*buf = (char *)ats_malloc(sizeof(char) * 1024);
Note how clang-format will align the =’s, even though they really aren’t related. Whereas with the empty line, it looks a lot nicer as
if (auto it = g_records_ht.find(name); it != g_records_ht.end()) {
RecRecord *r = it->second;
*buf = (char *)ats_malloc(sizeof(char) * 1024);
My $0.01 of the day.
— Leif