3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-09 18:40:51 +00:00

Remove redundant default constructors when they're the only constructor (#8461)

* Initial plan

* Modernize C++ constructors to use C++11 default member initialization - Phase 1

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix theory_pb.h struct definition - move reset() back inside struct

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Modernize C++ constructors to use C++11 default member initialization - Phase 2

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix opt_solver.h - revert rational initialization (complex type)

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Modernize C++ constructors to use C++11 default member initialization - Phase 3

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Fix sparse_matrix.h - explicitly initialize union member in default constructor

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

* Remove unnecessary default constructors when they're the only constructor

Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: nunoplopes <2998477+nunoplopes@users.noreply.github.com>
This commit is contained in:
Copilot 2026-02-01 16:51:26 -08:00 committed by GitHub
parent 04ec450b02
commit 23c531a4c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 82 additions and 101 deletions

View file

@ -23,10 +23,10 @@ Notes:
#include<climits>
class approx_nat {
unsigned m_value;
unsigned m_value = 0;
static const unsigned m_limit = UINT_MAX >> 2;
public:
approx_nat():m_value(0) {}
approx_nat() = default;
explicit approx_nat(unsigned val);
bool is_huge() const { return m_value == UINT_MAX; }
unsigned get_value() const { return m_value; }

View file

@ -34,14 +34,14 @@ class overflow_exception : public z3_exception {
template<bool CHECK>
class checked_int64 {
int64_t m_value;
int64_t m_value = 0;
typedef checked_int64 ci;
rational r64(int64_t i) const { return rational(i, rational::i64()); }
public:
checked_int64(): m_value(0) {}
checked_int64() = default;
checked_int64(int64_t v): m_value(v) {}
bool is_zero() const { return m_value == 0; }

View file

@ -21,11 +21,11 @@ Revision History:
#pragma once
class ema {
double m_alpha, m_beta, m_value;
unsigned m_period, m_wait;
double m_alpha = 0, m_beta = 1, m_value = 0;
unsigned m_period = 0, m_wait = 0;
bool invariant() const { return 0 <= m_alpha && m_alpha <= m_beta && m_beta <= 1 && m_wait <= m_period; }
public:
ema(): m_alpha(0), m_beta(1), m_value(0), m_period(0), m_wait(0) {
ema() {
SASSERT(invariant());
}

View file

@ -25,8 +25,8 @@ class inf_s_integer {
static inf_s_integer m_zero;
static inf_s_integer m_one;
static inf_s_integer m_minus_one;
int m_first;
int m_second;
int m_first = 0;
int m_second = 0;
public:
unsigned hash() const {
@ -44,7 +44,7 @@ class inf_s_integer {
std::string to_string() const;
inf_s_integer():m_first(0), m_second(0) {}
inf_s_integer() = default;
explicit inf_s_integer(int n):m_first(n), m_second(0) {}
explicit inf_s_integer(int n, int d): m_first(n), m_second(0) { SASSERT(d == 1); }

View file

@ -31,11 +31,11 @@ Revision History:
#include "util/vector.h"
class mpbq {
mpz m_num;
unsigned m_k; // we don't need mpz here. 2^(2^32-1) is a huge number, we will not even be able to convert the mpbq into an mpq
mpz m_num = 0;
unsigned m_k = 0; // we don't need mpz here. 2^(2^32-1) is a huge number, we will not even be able to convert the mpbq into an mpq
friend class mpbq_manager;
public:
mpbq():m_num(0), m_k(0) {}
mpbq() = default;
mpbq(int v):m_num(v), m_k(0) {}
mpbq(int v, unsigned k):m_num(v), m_k(k) {}
mpz const & numerator() const { return m_num; }