Re: [PATCH] static_assert: move before people start using it

From: Alexey Dobriyan
Date: Sun Mar 10 2019 - 17:30:12 EST


On Sun, Mar 10, 2019 at 10:19:37PM +0100, Rasmus Villemoes wrote:
> On 10/03/2019 11.51, Alexey Dobriyan wrote:
> > Userspace places static_assert() macro at <assert.h>
> >
>
> So? That seems a rather weak argument. We have lots of interfaces that
> also exist in userspace which are not declared in similar-named headers
> (e.g. we have no stdio.h, which is where snprintf lives). Not to mention
> that memcpy and friends are in <linux/string.h>, not a bare <string.h>.

Linux 0.01 had memcpy() in <string.h> in fact. :^)
I don't know what happened.

> Your assert.h would be the first and only header to live directly in
> include/.
>
> If you can somehow convince Andrew to take it you can add a Meh'ed-by me.

The whole BUILD_BUG() thing is a misnomer. Userspace has assert() forever
and it doesn't require double negating (which is why assert is good
and BUILD_BUG is bad). Once everything is converted to static_assert(),
it will live in build_bug.h, so might as well put it into right place
immediately.