Re: Using defines for protocol characters
Peter Smith <smithpb2250@gmail.com>
From: Peter Smith <smithpb2250@gmail.com>
To: Dave Cramer <davecramer@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Tatsuo Ishii <ishii@sraoss.co.jp>, pgsql-hackers@lists.postgresql.org, nathandbossart@gmail.com
Date: 2023-08-07T08:41:52Z
Lists: pgsql-hackers
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/replication/logicalproto.h#L57C31-L57C31 Kind Regards, Peter Smith Fujitsu Australia
Commits
-
Introduce macros for protocol characters.
- f4b54e1ed985 17.0 landed
-
Remove configure check for z_streamp
- eeb4eeea2c52 17.0 cited