On Mon, Aug 4, 2008 at 4:46 PM, thides <[EMAIL PROTECTED]> wrote: > --- In [email protected], "Brett McCoy" <[EMAIL PROTECTED]> wrote: >> >> A bug was found in some C++ code recently, in my company. This code is >> used on server software for when we have MX lookups for sending mail. >> It was found by a customer (*yikes*) after they had applied a Sun >> recommended patched cluster on their Solaris server: >> >> if (resState == NULL) { >> resState = new __res_state; //__res_state is a struct > *snip* > > I thought new and structs were not to be used together.
structs in C++ are essentially just classes with the default of public instead of private. Those without member functions are called PODs. (plain old data) How else would you dynamically assign a struct? (Hint: malloc() is not the correct answer here... ;) ) -- PJH 'Two Dead in Baghdad' not 'product-friendly' - Kent Ertugrul, chief executive of Phorm. http://shabbleland.myminicity.com
