Thread

  1. Re: Confused static assertion implementation

    Peter Eisentraut <peter@eisentraut.org> — 2025-12-15T11:58:40Z

    On 14.11.25 23:27, Thomas Munro wrote:
    > On Fri, Nov 14, 2025 at 6:18 PM Chao Li <li.evan.chao@gmail.com> wrote:
    >> As you added a semi-colon in the line, the one after the empty line can be deleted, though C allows empty statement, but unnecessary, and may lead to confusion for code readers.
    > 
    >> You missed to replace this pgac_cv__static_assert with the new name.
    > 
    > Ugh, yeah, the configure change was hopeless.  It looked like it
    > worked in configure's stdout, which I mistook for success and posted
    > too soon, sorry about that.  I have fixed those points and verified
    > that pg_config.h actually has the expected value.
    
    I have committed this, with some light editing of the comments.
    
    We are now down to 4 from previously 12 static assertion implementation 
    variants!
    
    Note, however, that the now committed non-statement-expression fallback 
    implementation of StaticAssertExpr() does not work under C++.  (The 
    compiler complains about "types may not be defined in 'sizeof' 
    expressions".)  This isn't a regression in the overall sense, since, as 
    you had mentioned, previously all C++ variants required statement 
    expressions.  So I think this can be added to the list of C++ 
    portability issues that Jelte is currently working through.