Re: code cleanups - Mailing list pgsql-hackers

From Robert Haas
Subject Re: code cleanups
Date
Msg-id CA+TgmoYwdWcePj+iKuwkrRePriY5=R6uK8hb-0W6F5QP+aK44Q@mail.gmail.com
Whole thread Raw
In response to Re: code cleanups  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Wed, Nov 23, 2022 at 12:53 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> at least for bool arrays, that's true of memset'ing as well.  But this,
> if you decide you need something other than zeroes, is a foot-gun.
> In particular, someone whose C is a bit weak might mistakenly think that
>
>         bool            nulls[PG_STAT_GET_RECOVERY_PREFETCH_COLS] = {true};
>
> will set all the array elements to true.  Nor is there a plausible
> argument that this is more efficient.  So I don't care for this approach
> and I don't want to adopt it.

I don't really know what the argument is for the explicit initializer
style, but I think this argument against it is pretty weak.

It should be more than fine to assume that anyone who is hacking on
PostgreSQL is proficient in C. It's true that there might be some
people who aren't, or who aren't familiar with the limitations of the
initializer construct, and I include myself in that latter category. I
don't think it was part of C when I learned C. But if we don't possess
the collective expertise as a project to bring people who have missed
these details of the C programming language up to speed, we should
just throw in the towel now and go home.

Hacking on PostgreSQL is HARD and it relies on knowing FAR more than
just the basics of how to code in C. Put differently, if you can't
even figure out how C works, you have no chance of doing anything very
interesting with the PostgreSQL code base, because you're going to
have to figure out a lot more than the basics of the implementation
language to make a meaningful contribution.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: fixing CREATEROLE
Next
From: Tom Lane
Date:
Subject: Re: fixing CREATEROLE