I've started to hack on Monty's suggestion of --enable-effective-style and I've gotten stuck. I was hoping someone could nudge me in the right direction. I'm getting several member initialization list errors in binary_log.pb.cc, which is an autogenerated protobuffers file built from binary_log.proto. Since it's autogenerated, it seems I can't just add the initialization of _unknown_fields_ in the Header constructor.
binary_log.pb.cc: In constructor ‘BinaryLog::Header::Header()’: binary_log.pb.cc:213: error: ‘BinaryLog::Header::_unknown_fields_’ should be initialized in the member initialization list I looked at the protobuf syntax for creating a .proto file and didn't see any syntax related to trying to solve this problem. In the protobuf source it looks like the generation is handled in src/google/protobuf/compiler/cpp, with cpp_generator.cc being key. Will I need to modify the protobuffers source in order to remove this error? What other ideas does anyone have to help get past this problem? Chris On Mon, Mar 9, 2009 at 1:22 PM, Monty Taylor <[email protected]> wrote: > If anybody is looking for a fun semi-mindless task to hack on... > > run configure with --enable-effective-style > > And then start fixing build failures. :) > > The flag enables warnings from Scott Meyers’ Effective C++ book: > > · Define a copy constructor and an assignment operator > for classes with dynamically allocated memory. > > · Prefer initialization to assignment in constructors. > > · Make destructors virtual in base classes. > > · Have "operator=" return a reference to *this. > > · Don’t try to return a reference when you must return > an object. > > And from Scott Meyers’ More Effective C++ book: > > · Distinguish between prefix and postfix forms of > increment and decrement operators. > > · Never overload "&&", "||", or ",". > > I gotta say I'd love to have this one on... and it makes me sad to see > the carnage when it's turned on. > > If you are new to C++ or are looking to find a good set of > best-practices, the Meyers book is a fairly standard and well regarded > set of them, as should be evidenced by the fact that some of them have > made it in to the GCC warning system. :) > > Monty > > _______________________________________________ > Mailing list: > https://launchpad.net/~drizzle-discuss<https://launchpad.net/%7Edrizzle-discuss> > Post to : [email protected] > Unsubscribe : > https://launchpad.net/~drizzle-discuss<https://launchpad.net/%7Edrizzle-discuss> > More help : https://help.launchpad.net/ListHelp >
_______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

