Re: Using defines for protocol characters

Поиск
Список
Период
Сортировка
От Peter Smith
Тема Re: Using defines for protocol characters
Дата
Msg-id CAHut+PuE-3tc_6m06bwnjftk2KBM728ZSDhuL1_=vRCfEGMZ1A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Using defines for protocol characters  (Dave Cramer <davecramer@gmail.com>)
Ответы Re: Using defines for protocol characters  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Drouvot, Bertrand"
Дата:
Сообщение: Fix badly generated entries in wait_event_names.txt
Следующее
От: Andrey Lepikhov
Дата:
Сообщение: Re: [PoC] Reducing planning time when tables have many partitions