David Kimura created GEODE-4032: ----------------------------------- Summary: Investigate enum types being used as integer values Key: GEODE-4032 URL: https://issues.apache.org/jira/browse/GEODE-4032 Project: Geode Issue Type: Improvement Components: native client Reporter: David Kimura
DiskPolicyType and ExpirationAction have enums being used as integers. Evaluate whether enum is the correct data type to use here. Consider change to use {{enum class DiskPolicy}} and {{enum class ExpirationAction}} which would throw compiler errors unless {{static_cast<int>}} is made. Example in {{ExpirationAction.hpp}}: {noformat} class CPPCACHE_EXPORT ExpirationAction { public: typedef enum { INVALIDATE = 0, LOCAL_INVALIDATE, DESTROY, LOCAL_DESTROY, INVALID_ACTION } Action; // ... }; {noformat} With usages in {{ExpirationAction.cpp}} like... {noformat} const char* ExpirationAction::fromOrdinal(const int ordinal) { if (INVALIDATE <= ordinal && ordinal <= LOCAL_DESTROY) { return names[ordinal]; } return nullptr; } {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)