[PATCH 1/7] Initialize everything to zero in devicedetails

Anton Lundin glance at acc.umu.se
Sun Oct 12 10:26:08 PDT 2014


On 12 October, 2014 - Anton Lundin wrote:

> Before this, if you did click save backup xml before you read the data,
> you would get a xml file full of bogus. This initializes everything to
> zero.
> 
> Signed-off-by: Anton Lundin <glance at acc.umu.se>
> ---
>  devicedetails.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 48 insertions(+), 2 deletions(-)
> 
> diff --git a/devicedetails.cpp b/devicedetails.cpp
> index 4f4d040..d192c67 100644
> --- a/devicedetails.cpp
> +++ b/devicedetails.cpp
> @@ -1,9 +1,55 @@
>  #include "devicedetails.h"
>  
> +// This can probably be done better by someone with better c++-FU
> +const struct gas zero_gas = {0};
> +const struct setpoint zero_setpoint = {0};
> +
>  DeviceDetails::DeviceDetails(QObject *parent) :
...
> +	m_gas1(zero_gas),
...
> +	m_sp1(zero_setpoint),


I was also wondering if any one with could point me to a better way of
zero-initializing these member structs?

The only recommendations i got from goggling about it was that they
should be converted to c++ classes...


//Anton


-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list