Re: [PATCH v3 06/15] Write status to CTF and read.

Doug Evans
2013-03-29T15:50:19Z

On Fri, Mar 29, 2013 at 12:23 AM, Yao Qi <yao@codesourcery.com> wrote:
> On 03/15/2013 02:06 AM, Doug Evans wrote:
>> > +#define SET_INT32_FIELD(EVENT, SCOPE, VAR, FIELD) \
>> > + VAR->FIELD = (int) bt_ctf_get_int64 (bt_ctf_get_field (EVENT, \
>> > + SCOPE, \
>> > + #FIELD))
>>
>> Macros like this should be in a do { } while (0).
>> do { \
>> ...; \
>> } while (0)
>>
>
> Do we really need do/while loop for this single-line macro?

Always IMO.

>> Plus wrap params in parens (except #FIELD of course).
>>
>
> Of course.

Look at it as wrapping the statement in a do/while is like wrapping
the params in parens. :-)