Re: Proposal: Add more compile-time asserts to expose inconsistencies.

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: "Smith, Peter" <peters@fast.au.fujitsu.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2019-09-19T01:07:40Z
Lists: pgsql-hackers
On Wed, Sep 18, 2019 at 04:46:30PM +0100, Dagfinn Ilmari Mannsåker wrote:
> Postgres doesn't seem to have it, but it would be possible to define a
> StaticAssertDecl macro that can be used at the file level, outside any
> function.  See for example Perl's STATIC_ASSERT_DECL:
> 
> https://github.com/Perl/perl5/blob/v5.30.0/perl.h#L3455-L3488

That sounds like a cleaner alternative.  Thanks for the pointer.
--
Michael

Commits

  1. Add declaration-level assertions for compile-time checks

  2. Add support for static assertions in C++