Re: C++ dynamic structures
- From: "Doug" <DugzDC@xxxxxxxxxxxxxxxx>
- Date: 29 Aug 2006 14:40:53 -0700
IIRC, I don't think that 'new' calls the ctors of structs when it
allocates them, whereas it does call the ctor for classes.
The only difference between struct and class is the default access
level of unqualified members. The distinction you have in mind is
between POD and non-POD (Googler, that's "Plain Old Data", a
technical term from the C++ standard. You can look it up.) As
std::string is non-POD so is TOKEN, which means that new default-
initializes each array element. The implicitly-defined default
constructor of TOKEN in turn default-constructs its members. It's
true that a POD array would stay uninitialized unless the newing line
ended in (), forcing zero-initialization.
Ah, yes, thanks. IDNRC. (I did not recall correctly!)
Doug
.
- References:
- C++ dynamic structures
- From: googlinggoogler
- Re: C++ dynamic structures
- From: Doug
- Re: C++ dynamic structures
- From: Martin Eisenberg
- C++ dynamic structures
- Prev by Date: Re: Network buffering question
- Next by Date: Re: Network buffering question
- Previous by thread: Re: C++ dynamic structures
- Next by thread: Re: C++ dynamic structures
- Index(es):