Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays
Дата
Msg-id 20191019154359.GO6962@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays  (Andres Freund <andres@anarazel.de>)
Ответы Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays  (Amit Kapila <amit.kapila16@gmail.com>)
Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays  ("Joe Nelson" <joe@begriffs.com>)
Список pgsql-hackers
Greetings,

* Andres Freund (andres@anarazel.de) wrote:
> On 2019-10-18 09:03:31 -0400, Stephen Frost wrote:
> > * Chapman Flack (chap@anastigmatix.net) wrote:
> > > On 10/18/19 08:18, Stephen Frost wrote:
> > > > I realize that I need to don some fireproof gear for suggesting this,
> > > > but I really wonder how much fallout we'd have from just allowing {} to
> > > > be used..  It's about a billion[1] times cleaner and more sensible than
> > > > using {0} and doesn't create a dependency on what the first element of
> > > > the struct is..
> > >
> > > I guess the non-flamey empirical question would be, if it's not ISO C,
> > > are we supporting any compiler that doesn't understand it?
> >
> > Right, that's basically what I was trying to ask. :)
>
> I don't understand why this is an issue worth deviating from the
> standard for.

Because this use and the way the standard is defined in this case is
confusing and could lead later hackers to misunderstand what's going on
and end up creating bugs- which is what a good chunk of this discussion
was about.  The {} construct is much clearer in this regard and while
it's not in the C standard it's in C++ and it's accepted by the commonly
used compilers (clang and and pretty far back it seems for gcc), without
warning unless you enable -pedantic or similar.

> Especially not when the person suggesting to do so isn't
> even doing the leg work to estimate the portability issues.

I figured it was common knowledge that gcc/clang supported it just fine,
which covers something like 90% of the buildfarm.  I haven't got easy
access to check others.

Thanks,

Stephen

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: SQL/JSON: JSON_TABLE
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: configure fails for perl check on CentOS8