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

Re: [PATCH] xen: Use __auto_type



On Mon, May 12, 2025 at 03:00:18PM +0200, Jan Beulich wrote:
> On 12.05.2025 14:09, Andrew Cooper wrote:
> > 
> > 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.
> 
> I'm not outright opposed, as I don't think we use "auto" with its
> original semantics, but it feels somewhat odd.

Problem is "auto" already has a defined meaning in C.  Having this will
subtly break contributions from authors who weren't familiar with
everything in Xen's headers.  For anyone who does anything with projects
besides Xen this will encourage bad habits.

I believe many projects have a rule of *never* #define C keywords.  I'm
surprised such made it into the Linux kernel.  I expect it will be ripped
out in the near future.

MISRA *doesn't* absolutely forbid this?


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         ehem+sigmsg@xxxxxxx  PGP 87145445         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445





 


Rackspace

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