public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Smith <[email protected]>
To: Dave Cramer <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Tatsuo Ishii <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: Using defines for protocol characters
Date: Mon, 7 Aug 2023 18:41:52 +1000
Message-ID: <CAHut+PuE-3tc_6m06bwnjftk2KBM728ZSDhuL1_=vRCfEGMZ1A@mail.gmail.com> (raw)
In-Reply-To: <CADK3HHJqDkOFNerEx_9QSotBp0Wk_QXLFn=XbgyriadGS_q=nw@mail.gmail.com>
References: <CADK3HH+-=08kd-aNCOP9s7fCZHUxrUBvVx5cyBJZzHD49wzPQA@mail.gmail.com>
	<[email protected]>
	<CADK3HHJqDkOFNerEx_9QSotBp0Wk_QXLFn=XbgyriadGS_q=nw@mail.gmail.com>

Hi, I wondered if any consideration was given to using an enum instead
of all the #defines.

I guess, your patch would not be much different; you can still have
all the nice names and assign the appropriate values to the enum
values same as now, but using an enum you might also gain
type-checking in the code and also get warnings for the "switch"
statements if there are any cases accidentally omitted.

For example, see typedef enum LogicalRepMsgType [1].

------
[1] https://github.com/postgres/postgres/blob/eeb4eeea2c525c51767ffeafda0070b946f26ae8/src/include/repli...

Kind Regards,
Peter Smith
Fujitsu Australia






view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Using defines for protocol characters
  In-Reply-To: <CAHut+PuE-3tc_6m06bwnjftk2KBM728ZSDhuL1_=vRCfEGMZ1A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox