RE: Proposal: Make use of C99 designated initialisers fornulls/values arrays
| От | Smith, Peter |
|---|---|
| Тема | RE: Proposal: Make use of C99 designated initialisers fornulls/values arrays |
| Дата | |
| Msg-id | 201DD0641B056142AC8C6645EC1B5F62014B91B2E8@SYD1217 обсуждение исходный текст |
| Ответ на | Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays (Isaac Morland <isaac.morland@gmail.com>) |
| Ответы |
Re: Proposal: Make use of C99 designated initialisers fornulls/values arrays
|
| Список | pgsql-hackers |
From: Isaac Morland <isaac.morland@gmail.com> Sent: Tuesday, 1 October 2019 11:32 PM
>Typical Example:
>Before:
> Datum values[Natts_pg_attribute];
> bool nulls[Natts_pg_attribute];
> ...
> memset(values, 0, sizeof(values));
> memset(nulls, false, sizeof(nulls));
>After:
> Datum values[Natts_pg_attribute] = {0};
> bool nulls[Natts_pg_attribute] = {0};
>
>I hope you'll forgive a noob question. Why does the "After" initialization for the boolean array have {0} rather than
{false}?
It is a valid question.
I found that the original memsets that this patch replaces were already using 0 and false interchangeably. So I just
pickedone.
Reasons I chose {0} over {false} are: (a) laziness, and (b) consistency with the values[] initialiser.
But it is no problem to change the bool initialisers to {false} if that becomes a committer review issue.
Kind Regards
--
Peter Smith
Fujitsu Australia
В списке pgsql-hackers по дате отправления: