The problem is that GCC emits two or three copies of each constructor. In order to keep generated code size down, we moved the constructor code into a separate method which could then be shared by the multiple copies that GCC emits. http://gcc.gnu.org/bugs.html#nonbugs_cxx
There is nothing "harmful" about this -- all fields are still being initialized properly. It's just happening somewhere other than the constructor. I recommend disabling the warning. Perhaps you can disable it just for .pb.cc files? On Thu, Jun 25, 2009 at 12:11 PM, dan.schmidt.valle < dan.schmidt.va...@gmail.com> wrote: > > Hi there, > > I'm developing an app in C++ and I use PB for lots of things. I'm also > in an environment that requires me to make sure the code passes very > strict warning levels. I found out when I started using them that PB > didn't include the _unknown_fields_ or any of the repeated field > containers in the member initialisation list. This resulted in me > having warnings all over the place (of the **should be initialized in > the member initialization list** sort), so I amended the > cpp_message.cc method > > void MessageGenerator::GenerateInitializerList(io::Printer* printer) > > to include the following line: printer->Print("_unknown_fields_ > (),\n"); > > and all the cpp_*_field.cc files to include initialisation for the > repeated files with: > > void RepeatedEnumFieldGenerator::GenerateInitializer(io::Printer* > printer) const { > printer->Print(variables_, ",\n$name$_()"); > } > > This was enough up to version 2.0.3. I now see that version 2.1.0 has > removed the initialisation of members from the constructor altogether. > I was wondering what the rationale for that had been, because I've > read that not doing that initialisation can be very harmful. > > Thanks a lot. > > Dan > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---