Home
last modified time | relevance | path

Searched hist:b31cef67 (Results 1 – 2 of 2) sorted by relevance

/openbmc/bmcweb/redfish-core/lib/
H A Dtask.hppb31cef67 Thu Jun 30 19:51:46 CDT 2022 Ed Tanous <edtanous@google.com> task payload, initialize jsonValue in constructor

We should do this because it means that variables are only initialized
once. In the simplest case:

struct MyClass{
std::string myString

MyClass(){
myString = "foo";

}

}

in the language, myString is constructed twice, once with empty string,
then a second time with "foo". If you do the construction in the
initializer list for the class the construction only happens once.

Now, the above case is contrived, the optimizer can see through it and
likely optimizes this case because std::string is relatively simple, but
for more complex structures, it's possible this generates less and
bettercompiled code, and this is worth having the check for, and making
our existing code correct.

Tested: cppcheck passing.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie5c7f293598408d437e7bf7b3fc93b0819e25f9f
/openbmc/bmcweb/redfish-core/include/
H A Devent_service_manager.hppb31cef67 Thu Jun 30 19:51:46 CDT 2022 Ed Tanous <edtanous@google.com> task payload, initialize jsonValue in constructor

We should do this because it means that variables are only initialized
once. In the simplest case:

struct MyClass{
std::string myString

MyClass(){
myString = "foo";

}

}

in the language, myString is constructed twice, once with empty string,
then a second time with "foo". If you do the construction in the
initializer list for the class the construction only happens once.

Now, the above case is contrived, the optimizer can see through it and
likely optimizes this case because std::string is relatively simple, but
for more complex structures, it's possible this generates less and
bettercompiled code, and this is worth having the check for, and making
our existing code correct.

Tested: cppcheck passing.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie5c7f293598408d437e7bf7b3fc93b0819e25f9f