Re: Using ASSUME in place of ASSERT in non-assert builds - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Using ASSUME in place of ASSERT in non-assert builds
Date
Msg-id 1529814.1752161726@sss.pgh.pa.us
Whole thread Raw
In response to Using ASSUME in place of ASSERT in non-assert builds  (Benjamin Coutu <ben.coutu@zeyos.com>)
List pgsql-hackers
Benjamin Coutu <ben.coutu@zeyos.com> writes:
> That got me thinking: some projects (like PHP) map the ASSERT macro to ASSUME in non-assert builds. The rationale is
thatASSERT typically expresses a tautology, something the programmer believes to be always true. So in builds where
assertionsare compiled out, we can still pass that information to the optimizer via ASSUME. 

My gut instinct is that this would not help much; we don't typically
write assertions that would help the compiler all that much.  And
in any case, to my mind there is a considerable difference in goals
between Assert and Assume, which I'd prefer not to fuzz like this.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Adding basic NUMA awareness
Next
From: "Zhou, Zhiguo"
Date:
Subject: Re: Optimize shared LWLock acquisition for high-core-count systems