public inbox for [email protected]
help / color / mirror / Atom feedFrom: Alvaro Herrera <[email protected]>
To: Peter Smith <[email protected]>
Cc: Dave Cramer <[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 11:10:44 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHut+PuE-3tc_6m06bwnjftk2KBM728ZSDhuL1_=vRCfEGMZ1A@mail.gmail.com>
On 2023-Aug-07, Peter Smith wrote:
> 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.
Hmm, I think omitting a 'default' clause (which is needed when you want
warnings for missing clauses) in a switch that handles protocol traffic
is not great, because the switch would misbehave when the network
counterpart sends a broken message. I'm not sure we want to do that.
It could become a serious security problem if confronted with a
malicious libpq.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
view thread (2+ messages)
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: <[email protected]>
* 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