Re: C99 compliance for src/port/snprintf.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Steele <david(at)pgmasters(dot)net>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: C99 compliance for src/port/snprintf.c
Date: 2018-08-15 19:57:43
Message-ID: 2069.1534363063@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

David Steele <david(at)pgmasters(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sand Stone 2018-08-15 20:32:45 Re: dsa_allocate() faliure
Previous Message David Steele 2018-08-15 19:37:51 Re: C99 compliance for src/port/snprintf.c

Browse pgsql-www by date

  From Date Subject
Next Message Andres Freund 2018-08-15 21:49:31 Re: C99 compliance for src/port/snprintf.c
Previous Message David Steele 2018-08-15 19:37:51 Re: C99 compliance for src/port/snprintf.c