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
-~----------~----~----~----~------~----~------~--~---

Reply via email to