Skip to content

Commit

Permalink
Remove some redundant casts
Browse files Browse the repository at this point in the history
clang-tidy dosn't like casting a constant out-of-enum value,
but default-initializing to the sam value is apparently fine.
  • Loading branch information
attah committed Aug 31, 2024
1 parent 03d024f commit 97d7791
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions codable.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class name : public Codable\
#define STRING(length, name)
#define CONST_STRING(name, value)
#define DEFAULT_STRING(length, name, default) name = default;
#define ENUM(type, name, ...) name = static_cast<name##_enum>(type());
#define ENUM(type, name, ...) name = name##_enum();
#include CODABLE_FILE
}

Expand Down Expand Up @@ -246,7 +246,7 @@ class name : public Codable\
#define ENUM(type, name, ...) \
ss << "ENUM " << #type << " " << #name << " " \
<< name##ToString(name) \
<< " (" << +static_cast<type>(name) << ")" << std::endl;
<< " (" << +name << ")" << std::endl;
#define PADDING(length) ss << "PADDING "<< length << std::endl;

#include CODABLE_FILE
Expand Down

0 comments on commit 97d7791

Please sign in to comment.