This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Style and Conventions: Multi-line function-like macro formatting.


On Thu, 18 Jan 2018, Zack Weinberg wrote:

> I would put it stronger: ({ ... }) is a GCC extension that should be
> _avoided_ unless absolutely necessary, when neither a do { ... } while
> (0) block inside a macro nor an inline function will do the job.

I don't see it as a problematic extension, in cases where you do want the 
value returned by the sequence of statements inside ({ }).  Preferring 
inline functions applies generically for anything that can readily be 
expressed as an inline function rather than a macro - they're better than 
both ({ }) and do { } while (0) in the cases where they work.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]