Skip to content

Commit

Permalink
cc: typing: add default constructor to type data classes
Browse files Browse the repository at this point in the history
  • Loading branch information
atirut-w committed Jul 27, 2024
1 parent 60071a1 commit a5adfc3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cc/include/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
struct Type
{
int size;

Type() = default;
Type(int size) : size{size} {}
virtual ~Type() = default; // Force polymorphism
};
Expand All @@ -17,6 +19,7 @@ struct PrimitiveType : public Type
std::vector<std::string> word_layout;
// TODO: Optional subroutine for name for sign extension

PrimitiveType() = default;
PrimitiveType(int size, std::vector<std::string> byte_layout, std::vector<std::string> word_layout)
: Type{size}, byte_layout{byte_layout}, word_layout{word_layout}
{
Expand Down

0 comments on commit a5adfc3

Please sign in to comment.