core: default initialize units-type objects to 0

Makes the code much nicer to read.

Default initialize cylinder_t to the empty cylinder.

This produces lots of warnings, because most structure are now
not PODs anymore and shouldn't be erased using memset().

These memset()s will be removed one-by-one and replaced by
proper constructors.

The whole ordeal made it necessary to add a constructor to
struct event. To simplify things the whole optimization of
the variable-size event names was removed. In upcoming commits
this will be replaced by std::string anyway.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-05-04 19:15:47 +02:00 committed by bstoeger
parent b82fdd1d20
commit 408b31b6ce
34 changed files with 128 additions and 148 deletions

View file

@ -24,25 +24,25 @@ struct dive;
struct stats_t
{
int period = 0;
duration_t total_time = { 0 };
duration_t total_time ;
/* total time of dives with non-zero average depth */
duration_t total_average_depth_time = { 0 };
duration_t total_average_depth_time;
/* avg_time is simply total_time / nr -- let's not keep this */
duration_t shortest_time = { 0 };
duration_t longest_time = { 0 };
depth_t max_depth = { 0 };
depth_t min_depth = { 0 };
depth_t avg_depth = { 0 };
depth_t combined_max_depth = { 0 };
volume_t max_sac = { 0 };
volume_t min_sac = { 0 };
volume_t avg_sac = { 0 };
temperature_t max_temp = { 0 };
temperature_t min_temp = { 0 };
temperature_sum_t combined_temp = { 0 };
duration_t shortest_time;
duration_t longest_time;
depth_t max_depth;
depth_t min_depth;
depth_t avg_depth;
depth_t combined_max_depth;
volume_t max_sac;
volume_t min_sac;
volume_t avg_sac;
temperature_t max_temp;
temperature_t min_temp;
temperature_sum_t combined_temp;
unsigned int combined_count = 0;
unsigned int selection_size = 0;
duration_t total_sac_time = { 0 };
duration_t total_sac_time;
bool is_year = false;
bool is_trip = false;
std::string location;