4 ms·
Yes, this exactly - as soon as I saw that, I was like “how did he pull that off?”. Of course, the first comment on HN has the answer. I am going to try this t
by drudru11 8y ago
Yes, this exactly - as soon as I saw that, I was like “how did he pull that off?”.
Of course, the first comment on HN has the answer.
I am going to try this trick out today.
- drudru11 8y agoThe exact line is here: https://github.com/boazsegev/facil.io/blob/master/lib/facil/http/http.h#L183 https://github.com/boazsegev/facil.io/blob/master/lib/facil/... I've seen other hacks to do this, but this is the cleanest that I've seen. He uses the same name for the macro and the function. The only thing I would change is the way the struct is passed. I would pass by reference. I really like this.
- tom_mellior 8y ago> I would pass by reference. Interesting. I expected taking the address of a struct literal to be illegal, but GCC and Clang both accept it. It does make sense, I guess. But may I ask why you would pass it by reference? With old ABIs, the struct would be passed on the stack (i.e., by reference) anyway, and with more recent ones, a small prefix would be in registers but the rest passed by reference as well. So why bother manually cluttering the code?