Hi Hans N,
Thanks for your response. So, I guess, we are going to follow
the same for other class constructors as well in Amf ?
Thanks
-Nagu
> -----Original Message-----
> From: Hans Nordebäck [mailto:[email protected]]
> Sent: 28 May 2014 16:39
> To: Nagendra Kumar; Hans Feldt
> Cc: [email protected]
> Subject: RE: [devel] [PATCH 1 of 1] amfd: fix SU constructor [#713]
>
> Hi Nagu, I think it is good practice to use explicit for constructors taking
> one
> argument to avoid implicit conversions. If implicit conversions is needed it
> should be removed/Regards HansN
>
> -----Original Message-----
> From: Nagendra Kumar [mailto:[email protected]]
> Sent: den 28 maj 2014 12:58
> To: Hans Feldt; Hans Nordebäck
> Cc: [email protected]
> Subject: RE: [devel] [PATCH 1 of 1] amfd: fix SU constructor [#713]
>
> Can you please share the advantage for using 'explicit' here:
>
> + explicit AVD_SU(const SaNameT *dn);
>
> Thanks
> -Nagu
>
> > -----Original Message-----
> > From: Hans Feldt [mailto:[email protected]]
> > Sent: 28 May 2014 13:16
> > To: [email protected]
> > Cc: [email protected]
> > Subject: [devel] [PATCH 1 of 1] amfd: fix SU constructor [#713]
> >
> > osaf/services/saf/amf/amfd/include/su.h | 2 +-
> > osaf/services/saf/amf/amfd/su.cc | 43
> > ++++++++++++++++++--------------
> > 2 files changed, 25 insertions(+), 20 deletions(-)
> >
> >
> > saAmfSUMaintenanceCampaign was not initialized properly thus causing
> > SMF campaigns to fail. While fixing that we align to "rule":
> > http://www.parashift.com/c++-faq/init-lists.html and initialize
> > attributes using the initialization list rather than assignment.
> >
> > diff --git a/osaf/services/saf/amf/amfd/include/su.h
> > b/osaf/services/saf/amf/amfd/include/su.h
> > --- a/osaf/services/saf/amf/amfd/include/su.h
> > +++ b/osaf/services/saf/amf/amfd/include/su.h
> > @@ -93,7 +93,7 @@ class AVD_SU {
> > AVD_SU *su_list_su_type_next;
> >
> > AVD_SU() {};
> > - AVD_SU(const SaNameT *dn);
> > + explicit AVD_SU(const SaNameT *dn);
> > ~AVD_SU() {};
> > void set_su_failover(bool value);
> > void dec_curr_stdby_si();
> > diff --git a/osaf/services/saf/amf/amfd/su.cc
> > b/osaf/services/saf/amf/amfd/su.cc
> > --- a/osaf/services/saf/amf/amfd/su.cc
> > +++ b/osaf/services/saf/amf/amfd/su.cc
> > @@ -32,27 +32,32 @@
> >
> > AmfDb<AVD_SU> *su_db = NULL;
> >
> > -AVD_SU::AVD_SU(const SaNameT *dn) {
> > +AVD_SU::AVD_SU(const SaNameT *dn):
> > + saAmfSURank(0),
> > + saAmfSUFailover(false),
> > + saAmfSUFailover_configured(false),
> > + saAmfSUPreInstantiable(static_cast<SaBoolT>(false)),
> > + saAmfSUOperState(SA_AMF_OPERATIONAL_DISABLED),
> > +
> > saAmfSuReadinessState(SA_AMF_READINESS_OUT_OF_SERVICE),
> > +
> > saAmfSUPresenceState(SA_AMF_PRESENCE_UNINSTANTIATED),
> > + saAmfSUNumCurrActiveSIs(0),
> > + saAmfSUNumCurrStandbySIs(0),
> > + saAmfSURestartCount(0),
> > + term_state(false),
> > + su_switch(AVSV_SI_TOGGLE_STABLE),
> > + su_is_external(false),
> > + sg_of_su(NULL),
> > + su_on_node(NULL),
> > + list_of_susi(NULL),
> > + list_of_comp(NULL),
> > + sg_list_su_next(NULL),
> > + avnd_list_su_next(NULL),
> > + su_type(NULL),
> > + su_list_su_type_next(NULL) {
> > +
> > memcpy(name.value, dn->value, sizeof(name.value));
> > name.length = dn->length;
> > - saAmfSUFailover = false;
> > - term_state = false;
> > - su_switch = AVSV_SI_TOGGLE_STABLE;
> > - saAmfSUPreInstantiable = static_cast<SaBoolT>(false);
> > - saAmfSUOperState = SA_AMF_OPERATIONAL_DISABLED;
> > - saAmfSUPresenceState = SA_AMF_PRESENCE_UNINSTANTIATED;
> > - saAmfSuReadinessState = SA_AMF_READINESS_OUT_OF_SERVICE;
> > - saAmfSUNumCurrActiveSIs = 0;
> > - saAmfSUNumCurrStandbySIs = 0;
> > - su_is_external = false;
> > - sg_of_su = NULL;
> > - su_on_node = NULL;
> > - list_of_susi = NULL;
> > - list_of_comp = NULL;
> > - sg_list_su_next = NULL;
> > - avnd_list_su_next = NULL;
> > - su_type = NULL;
> > - su_list_su_type_next = NULL;
> > + saAmfSUMaintenanceCampaign.length = 0;
> > saAmfSUHostedByNode.length = 0;
> > pend_cbk.invocation = 0;
> > pend_cbk.admin_oper = (SaAmfAdminOperationIdT)0;
> >
> > ----------------------------------------------------------------------
> > -------- Time is money. Stop wasting it! Get your web API in 5
> > minutes.
> > www.restlet.com/download
> > http://p.sf.net/sfu/restlet
> > _______________________________________________
> > Opensaf-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/opensaf-devel
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel