Skip to content

Commit

Permalink
featdefs: Optimize code by using constexpr
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stweil committed May 25, 2019
1 parent 7628112 commit 23d05a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/classify/featdefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/classify/featdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 23d05a5

Please sign in to comment.