On Sun. 8 Dec. 2024 at 00:10, Martin Uecker <muecker@xxxxxxx> wrote: > Am Samstag, dem 07.12.2024 um 22:50 +0900 schrieb Vincent Mailhol: > > On Sat. 7 Dec. 2024 à 22:19, Martin Uecker <muecker@xxxxxxx> wrote: > > > > ... > > > > > I was invited to WG14 this September. For now, I am only lurking. The > > thing I have in mind right now is to write a paper to allow the use of > > static_assert() in expressions (i.e. make it return 0 on success). > > That should be a relatively small change, but would bring a nice > > quality of life improvement. > > > > For context, look at this: > > > > https://lore.kernel.org/all/CAHk-=wjLSEcZ5LdW+3C+9rtjvNPHZT6zdk0POj67T5k2ZpDbgA@xxxxxxxxxxxxxx/T/#m1ba33a804b4041154b72a1d0333f90ec7204c461 > > What one can do is put it into a structure. > > #define const_assert(x) \ > (sizeof(struct { _Static_assert(x, ""); })) > > but yeah, also a hack to work around a limitation of the standard > feature. If you scroll down a couple more messages, you can see that Linus came up with that exact same hack :-) It is now upstreamed in: https://git.kernel.org/torvalds/c/d7a516c6eeae And yes, this solves the problem for the kernel, but I would still like to change the standard to solve it for everyone else. Yours sincerely, Vincent Mailhol