Обсуждение: name of enum used in 'Cache if PathTarget and RestrictInfos contain volatile functions'

Поиск
Список
Период
Сортировка

name of enum used in 'Cache if PathTarget and RestrictInfos contain volatile functions'

От
Zhihong Yu
Дата:
Hi,
I was looking at:
  Cache if PathTarget and RestrictInfos contain volatile functions

VOLATILITY_NOVOLATILE caught my attention. Since the enum values don't start with HAS, I think VOLATILITY_NONVOLATILE would be easier to read.
Actually I think since the enums are defined in VolatileFunctionStatus, they can be simply called (the prefix should be redundant):

UNKNOWN
NONVOLATILE
VOLATILE

Thanks

Re: name of enum used in 'Cache if PathTarget and RestrictInfos contain volatile functions'

От
Peter Smith
Дата:
On Mon, Mar 29, 2021 at 1:15 PM Zhihong Yu <zyu@yugabyte.com> wrote:
>
> Hi,
> I was looking at:
>   Cache if PathTarget and RestrictInfos contain volatile functions
>
> VOLATILITY_NOVOLATILE caught my attention. Since the enum values don't start with HAS, I think VOLATILITY_NONVOLATILE
wouldbe easier to read.
 
> Actually I think since the enums are defined in VolatileFunctionStatus, they can be simply called (the prefix should
beredundant):
 
>
> UNKNOWN
> NONVOLATILE
> VOLATILE
>

Although it seems like a good idea to remove prefixes, a name as
common as UNKNOWN is going to clash [1] with something else, which
IIUC is why the enums all have prefixes in the first place.

------
[1] https://stackoverflow.com/questions/35380279/avoid-name-collisions-with-enum-in-c-c99

Kind Regards,
Peter Smith.
Fujitsu Australia