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

From Smith, Peter
Subject RE: Proposal: Add more compile-time asserts to exposeinconsistencies.
Date
Msg-id 201DD0641B056142AC8C6645EC1B5F62014B9DA86E@SYD1217
Whole thread Raw
In response to Re: Proposal: Add more compile-time asserts to exposeinconsistencies.  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
-----Original Message-----
From: Andres Freund <andres@anarazel.de> Sent: Tuesday, 3 December 2019 2:56 AM
> +StaticAssertDecl(lengthof(LockTagTypeNames) == (LOCKTAG_ADVISORY + 1),
> +                 "LockTagTypeNames array inconsistency");
> +
>
>These error messages strike me as somewhat unhelpful. I'd probably just reword them as "array length mismatch" or
somethinglike that. 

OK.  I have no problem to modify all my current assertion messages to your suggested text ("array length mismatch") if
youthink it is better. 

Please correct me if I am wrong, but I didn't think the error message text is of very great significance here because
itis a compile-time issue meaning the *only* person who would see the message is the 1 developer who accidentally
introduceda bug just moments beforehand. The compile will fail with a source line number, and when the developer sees
theStaticAssertDecl at that source line the cause of the error is anyway self-evident by the condition parameter.  

Kind Regards
--
Peter Smith
Fujitsu Australia




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: about allow_system_table_mods and SET STATISTICS
Next
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index.