Re: embedded list v3

Andres Freund <andres@2ndquadrant.com>

From: Andres Freund <andres@2ndquadrant.com>
To: pgsql-hackers@postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Alvaro Herrera <alvherre@2ndquadrant.com>, Robert Haas <robertmhaas@gmail.com>, Peter Geoghegan <peter@2ndquadrant.com>
Date: 2012-09-30T20:33:47Z
Lists: pgsql-hackers
On Sunday, September 30, 2012 06:57:32 PM Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > Patch 0001 contains a assert_compatible_types(a, b) and a
> > assert_compatible_types_bool(a, b) macro which I found very useful to
> > make it harder to misuse the api. I think its generally useful and
> > possibly should be used in more places.
> 
> This seems like basically a good idea, but the macro names are very
> unfortunately chosen: they don't comport with our other names for
> assertion macros, and they imply that the test is symmetric which it
> isn't.  It's also unclear what the point of the _bool version is
> (namely, to be used in expression contexts in macros).
> 
> I suggest instead
> 
> 	AssertVariableIsOfType(varname, typename)
> 
> 	AssertVariableIsOfTypeMacro(varname, typename)
> 
> Or possibly we should leave off the "Assert" prefix, since this will be
> a compile-time-constant check and thus not really all that much like
> the existing run-time Assert mechanism.  Or write "Check" instead of
> "Assert", or some other verb.
> 
> Anybody got another color for this bikeshed?
No, happy with the new name.

Thanks for committing! Wondered for a minute what the point of autoconfiscation 
is/was but I see that e.g. clang already works... Nice.

The bizarre syntactic placement requirements directly come from the standard 
btw. No idea why they thought that would be a good idea... (check 6.7.1, 
6.7.2.1, 6.7.10).

Perhaps we need to decouple _Static_assert support from compound statement 
support at some point, but we will see.

Greetings,

Andres
-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Provide some static-assertion functionality on all compilers.

  2. Add infrastructure for compile-time assertions about variable types.

  3. Remove 576 references of include files that were not needed.

  4. More include file adjustments.

  5. Allow each C include file to compile on its own by including any needed