featdefs: Optimize code by using constexpr

This also fixes some warnings from clang++:

    src/classify/featdefs.cpp:47:15: warning: declaration requires a global constructor [-Wglobal-constructors]
    src/classify/featdefs.cpp:57:15: warning: declaration requires a global constructor [-Wglobal-constructors]
    src/classify/featdefs.cpp:66:15: warning: declaration requires a global constructor [-Wglobal-constructors]
    src/classify/featdefs.cpp:75:15: warning: declaration requires a global constructor [-Wglobal-constructors]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-05-20 22:24:28 +02:00 committed by zdenop
parent a4e1378218
commit cb6cf802e0
2 changed files with 8 additions and 8 deletions

View File

@ -29,10 +29,10 @@
/*-----------------------------------------------------------------------------
Global Data Definitions and Declarations
-----------------------------------------------------------------------------*/
const char* kMicroFeatureType = "mf";
const char* kCNFeatureType = "cn";
const char* kIntFeatureType = "if";
const char* kGeoFeatureType = "tb";
constexpr const char* kMicroFeatureType = "mf";
constexpr const char* kCNFeatureType = "cn";
constexpr const char* kIntFeatureType = "if";
constexpr const char* kGeoFeatureType = "tb";
// Define all of the parameters for the MicroFeature type.
StartParamDesc(MicroFeatureParams)

View File

@ -26,10 +26,10 @@
/* Enumerate the different types of features currently defined. */
#define NUM_FEATURE_TYPES 4
extern const char* kMicroFeatureType;
extern const char* kCNFeatureType;
extern const char* kIntFeatureType;
extern const char* kGeoFeatureType;
extern const char* const kMicroFeatureType;
extern const char* const kCNFeatureType;
extern const char* const kIntFeatureType;
extern const char* const kGeoFeatureType;
/* A character is described by multiple sets of extracted features. Each
set contains a number of features of a particular type, for example, a