[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xen: Use __auto_type



On Mon, May 12, 2025 at 1:09 PM Andrew Cooper <andrew.cooper3@xxxxxxxxxx> wrote:
>
> On 12/05/2025 12:59 pm, Jan Beulich wrote:
> > On 05.05.2025 21:44, Stefano Stabellini wrote:
> >> On Mon, 5 May 2025, Andrew Cooper wrote:
> >>> In macros it is common to declare local variables using typeof(param) in 
> >>> order
> >>> to ensure that side effects are only evaluated once.  A consequence of 
> >>> this is
> >>> double textural expansion of the parameter, which can get out of hand very
> >>> quickly with nested macros.
> >>>
> >>> A GCC extension, __auto_type, is now avaialble in the new toolchain 
> >>> baseline
> >>> and avoids the double textural expansion.
> >> I think this is a good change
> > +1
>
> That looks like agreement.
>
> Now for the (new) controversial part.  Since sending this, Linux has
> decided to just #define auto __auto_type for C < 23, in order to start
> writing C23 compatible code from now.  It's more succinct, and has
> better longevity.
>
> We might want to consider the same, although it will introduce a new
> example of defining a keyword, which we'd have to call out in the
> MISRA/Eclair config.
>
> If we're going to do this, we should do it from the outset.
>
> Thoughts?
>
> ~Andrew
>

I vote for avoiding extensions when the same feature is implemented by
standard, so yes for using "auto".

Frediano



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.