Re: pgbench - doCustom cleanup
От | Alvaro Herrera |
---|---|
Тема | Re: pgbench - doCustom cleanup |
Дата | |
Msg-id | 20181121180840.qo2646ocipca4ggs@alvherre.pgsql обсуждение исходный текст |
Ответ на | Re: pgbench - doCustom cleanup (Fabien COELHO <coelho@cri.ensmp.fr>) |
Список | pgsql-hackers |
On 2018-Nov-20, Fabien COELHO wrote: > > On INSTR_TIME_SET_CURRENT_LAZY(), you cannot just put an "if" inside a > > macro -- consider this: > > if (foo) > > INSTR_TIME_SET_CURRENT_LAZY(bar); > > else > > something_else(); > > Which "if" is the else now attached to? Now maybe the C standard has an > > answer for that (I don't know what it is), but it's hard to read and > > likely the compiler will complain anyway. I wrapped it in "do { } > > while(0)" as is customary. > > Indeed, good catch. Actually, reviewing this bit again, I realized that it should be a statement that evaluates to whether the change was made or not -- this way, it can be used in one existing place. Pushed that way. (I verified that InstrStartNode fails in the expected way if you call it twice.) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-hackers по дате отправления: