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

From Thomas Munro
Subject Re: C99 compliance for src/port/snprintf.c
Date
Msg-id CAEepm=0VJni=K_dAyh84p0hHZ8DNS5Si49eqO_CsoRXoTjcxhw@mail.gmail.com
Whole thread Raw
In response to Re: C99 compliance for src/port/snprintf.c  (Andres Freund <andres@anarazel.de>)
Responses Re: C99 compliance for src/port/snprintf.c
Re: C99 compliance for src/port/snprintf.c
List pgsql-hackers
On Thu, Aug 16, 2018 at 10:40 AM, Andres Freund <andres@anarazel.de> wrote:
> Hi,
>
> On 2018-08-15 18:31:10 -0400, Tom Lane wrote:
>> Andres Freund <andres@anarazel.de> writes:
>> > On 2018-08-15 18:13:59 -0400, Tom Lane wrote:
>> >> Experimenting here says that even reasonably modern gcc's won't take
>> >> declarations-inside-for without "--std=c99" or such.
>>
>> > I think autoconf's magic knows about most of that:
>> >  — Macro: AC_PROG_CC_C99
>>
>> Ah, of course.  What about the MSVC build?
>
> It looks like it mostly just enables that by default. But I only looked
> cursorily.  It's a bit annoying because that makes it harder to be sure
> which animals support what.  Looks like e.g. hammerkop (supposedly msvc
> 2005) might not support the subset we want; not that I'd loose sleep
> over raising the minimum msvc in master a bit.

Really?  I am not an MSVC user but I had the impression that their C
mode (/TC or files named .c) was stuck on C89/C90 as a matter of
policy, as Herb Sutter explained here (though maybe the situation has
changed since then):

https://herbsutter.com/2012/05/03/reader-qa-what-about-vc-and-c99/

That's presumably why cfbot's appveyor build always complains about
people declaring variables after statements.  To allow that particular
language feature, it looks like you have to tell it that your .c file
is really a C++ program with /TP.  But that opens a separate can of
worms, doesn't it?

--
Thomas Munro
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Shay Rojansky
Date:
Subject: Re: Stored procedures and out parameters
Next
From: Tom Lane
Date:
Subject: Re: C99 compliance for src/port/snprintf.c