ma740988 wrote:
|| modifying the struct's definition (which means modifying the header
file).
For a POD "struct' defintion.
enum RadarModulation
{
Continuous_Wave, // CW
FM, // noise frequency
AM, // AM modulation
};
struct myStruct
{
unsigned int Val1;
unsigned int Val2;
unsigned int Arr[0x1000];
RadarModulation RM;
// more stuff
};
memsetting myStruct will be a - fast / sure way to initaliaze things to
zero?
I'm confused. Are you changing the topic of the thread with this
question or are you expanding on what Howard said? Also, please
indicate whom you are quoting since not all people use Google Groups
(which, BTW, will quote messages and identify the author for you if you
click "show options" and then "Reply" in the revealed header).
As for std::memset, while it will work on some POD structs, you cannot
safely use such a structs/classes with pointer member(s) to dynamically
allocated memory (which count as PODs; see
http://www.parashift.com/c++-faq-lit...html#faq-26.7).
Virtual tables will also cause a problem if they are introduced, and
even if you don't use such features, the next programmer to touch the
code might. Thus, private data and constructors are to be preferred
generally speaking, and of course, std::vector is to be preferred to
arrays (see
http://www.parashift.com/c++-faq-lit...html#faq-34.1).
Cheers! --M