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

Started by Zhihong Yualmost 5 years ago2 messages
#1Zhihong Yu
zyu@yugabyte.com

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_NO*N*VOLATILE 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

#2Peter Smith
smithpb2250@gmail.com
In reply to: Zhihong Yu (#1)
Re: name of enum used in 'Cache if PathTarget and RestrictInfos contain volatile functions'

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 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

Although it seems like a good idea to remove prefixes, a name as
common as UNKNOWN is going to clash [1]https://stackoverflow.com/questions/35380279/avoid-name-collisions-with-enum-in-c-c99 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