Re: Proposal: Add more compile-time asserts to exposeinconsistencies. - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Proposal: Add more compile-time asserts to exposeinconsistencies.
Date
Msg-id 20200131054616.GD2631@paquier.xyz
Whole thread Raw
In response to Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Proposal: Add more compile-time asserts to exposeinconsistencies.
List pgsql-hackers
On Fri, Jan 31, 2020 at 02:15:42PM +0900, Kyotaro Horiguchi wrote:
> As a cross check, it cleanly applied and worked as expected. The
> fallback definition of StaticAssertDecl for C worked for gcc 8.3.

Thanks for the review.

> - * Macros to support compile-time assertion checks.
> + * Macros to support compile-time and declaration assertion checks.
>
> All the StaticAssert things check compile-time assertion.  I think
> that the name StaticAssertDecl doesn't mean "declaration assertion",
> but means "static assertion as a declaration". Is the change needed?

Hmm.  Yeah, that sounds right.

> - * If the "condition" (a compile-time-constant expression) evaluates to false,
> - * throw a compile error using the "errmessage" (a string literal).
> + * If the "condition" (a compile-time-constant or declaration expression)
> + * evaluates to false, throw a compile error using the "errmessage" (a
> + * string literal).
>
> I'm not sure what the "declaration expression" here means.  I think
> the term generally means "a variable declaration in expressions",
> something like "r = y * (int x = blah)".  In that sense, the parameter
> for StaticAssertDecl is just a compile-time constant expression. Is it
> a right rewrite?

Actually, thinking more about it, I'd rather remove this part as well,
keeping only the change in the third paragraph of this comment block.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: standby apply lag on inactive servers
Next
From: Craig Ringer
Date:
Subject: Re: MSVC installs too much stuff?