Re: Documenting coding style - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Documenting coding style
Date
Msg-id f232a120-8d7c-42d5-9e50-249c49b6f1ed@eisentraut.org
Whole thread
In response to Re: Documenting coding style  (Nathan Bossart <nathandbossart@gmail.com>)
List pgsql-hackers
On 10.04.26 16:49, Nathan Bossart wrote:
>> I wonder if we should move the coding style section out of sgml into a
>> top-level CODING_STYLE.md or something like that.
>>
>> And then obviously add things like Size being deprecated.
> Unless we're going to actually remove the typedef in the near future, I'm
> not sure I'd support even marking it deprecated.  If we're going to keep it
> around indefinitely, that's just going to become another source of nitpicks
> when new contributors inevitably copy/paste some code from the aughts.  A
> style page makes the situation a little better, but it's yet another thing
> that folks have to remember.

In this case, if one wanted to do something, one should at least enhance 
the code comment for Size, which is currently very bare and doesn't 
explain why the type exists.

As some counterexamples, some of which I wrote:

/*
  * Pointer
  *      Variable holding address of any memory resident object.
  *      (obsolescent; use void * or char *)
  */
typedef void *Pointer;

/* Historical names for types in <stdint.h>. */
typedef int8_t int8;
...

  * We require C11 and C++11, so static_assert() is expected to be there.
  * StaticAssertDecl() was previously used for portability, but it's now 
just a
  * plain wrapper and doesn't need to be used in new code.




pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: DOCS - Add introductory paragraph to Getting Started chapter
Next
From: Tom Lane
Date:
Subject: Re: Do we still need gen_node_support.pl's nodetag ABI stability check?