This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Style and Conventions: Multi-line function-like macro formatting.
On 01/18/2018 12:46 PM, Joseph Myers wrote:
> On Thu, 18 Jan 2018, Zack Weinberg wrote:
>
>> I think we're in violent agreement: An inline function should be used
>> whenever possible. If it is not possible, use do { } while (0) unless
>> the macro needs to act like an expression.
>>
>> The wiki should probably also mention the need to use (__extension__
>> ({ ... })) when the construct appears in public headers.
>
> I've now edited the wiki page accordingly.
Thank you all for the fedback and adjusted comments!
I think what we have now is better than the vague recollections we had
before about what should or might be used in glibc.
I wrote this specifically as a consequence of Arjun's recent patch to
change some malloc function-like macros. Hopefully we'll cleanup some
uses in malloc thanks to this.
--
Cheers,
Carlos.