Re: C99 compliance for src/port/snprintf.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: C99 compliance for src/port/snprintf.c
Date
Msg-id 2069.1534363063@sss.pgh.pa.us
Whole thread Raw
In response to Re: C99 compliance for src/port/snprintf.c  (David Steele <david@pgmasters.net>)
Responses Re: C99 compliance for src/port/snprintf.c
List pgsql-hackers
David Steele <david@pgmasters.net> writes:
> On 8/15/18 3:18 PM, Tom Lane wrote:
>> I do dearly miss the ability to easily limit the scope of a loop's
>> control variable to just the loop, eg
>>     for (int i = 0; ...) { ... }
>> But AFAIK that's C++ not C99.

> This works in C99 -- and I'm a really big fan.

It does?  [ checks standard... ]  Oh wow:

       6.8.5  Iteration statements

       Syntax

               iteration-statement:
                       while ( expression ) statement
                       do statement while ( expression ) ;
                       for ( expr-opt ; expr-opt ; expr-opt ) statement
                       for ( declaration ; expr-opt ; expr-opt ) statement

I'd always thought this was only in C++.  This alone might be a sufficient
reason to drop C89 compiler support ...

            regards, tom lane


pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: C99 compliance for src/port/snprintf.c
Next
From: Andres Freund
Date:
Subject: Re: questions about the logical decoding implementation