Closed nihguy closed 4 years ago
This do/while works as a goto statement, so we can skip a block of code and go directly to the cleanup in case of error.
Thank you for this PR.
Great solution! I did a simple benchmark test using both do/while
and nested ifs
on g++ 9
and the former gets a better performance. It's just 1 or 2 ns, but the code block doesn't sacrifice performance to make the code cleaner.
A new approach to the utility belt. Thank you for your answer.
The
ElfW(Type)
macro definition turns its argument into the name of an ELF data type suitable for the hardware architecture. For example,ElfW(Ehdr)
yields the data type nameElf32_Ehdr
on a 32-bit platforms, andElf64_Ehdr
on 64-bit platforms, as explains thelink.h
header file.I'm curious: Is
do{ }while(0);
really necessary? Why?