mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: convert sample.c to C++ and add default constructor
This changes default behavior when creating a sample struct in C++ code: it is now initialized to default values. If this ever turns out to be a performance problem, we can either add additional constructors or use special functions that do not initialize memory, such as make_unique_for_overwrite. This removes non-standard (respectively >C++20) constructs, namely designated initializers. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
f47196087e
commit
c8c533e791
5 changed files with 30 additions and 6 deletions
|
|
@ -33,6 +33,9 @@ struct sample // BASE TYPE BYTES UNITS RANGE
|
|||
bool in_deco; // bool 1 y/n y/n this sample is part of deco
|
||||
bool manually_entered; // bool 1 y/n y/n this sample was entered by the user,
|
||||
// not calculated when planning a dive
|
||||
#ifdef __cplusplus
|
||||
sample(); // Default constructor
|
||||
#endif
|
||||
}; // Total size of structure: 63 bytes, excluding padding at end
|
||||
|
||||
extern void add_sample_pressure(struct sample *sample, int sensor, int mbar);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue