Consider the case where you define a message Foo in foo.proto, and then you extend it in bar.proto. When generating code for foo.proto, protoc doesn't necessarily know anything about bar.proto, so how could it generate anything based on the extensions defined there? Instead, extensions are generated in the scope where they are defined.
On Thu, Jul 22, 2010 at 4:41 AM, Srivats P <pstav...@gmail.com> wrote: > Hi, > > As per CHANGES.txt for "2009-05-13 version 2.1.0" > <snip> > * For each field, the generated code contains an integer constant assigned > to the field number. For example, the .proto file: > message Foo { optional int bar_baz = 123; } > would generate the following constants, all with the integer value 123: > C++: Foo::kBarBazFieldNumber > Java: Foo.BAR_BAZ_FIELD_NUMBER > Python: Foo.BAR_BAZ_FIELD_NUMBER > Constants are also generated for extensions, with the same naming > scheme. > These constants may be used as switch cases. > </snip> > > All my .proto files use a global namespace via the "package MyProto" > directive. > > The constants for members of message Foo are in the MyProto::Foo > namespace while extension members of Foo are in the MyProto:: > namespace (not MyProto::Foo). Is this intentional? If so, the above > changelog snippet seems to indicate otherwise. > > Regards, > Srivats > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To post to this group, send email to proto...@googlegroups.com. > To unsubscribe from this group, send email to > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/protobuf?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to proto...@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.