Hi,

I was 
reading https://developers.google.com/protocol-buffers/docs/cpptutorial and 
I think I found a few typos in the code examples.


For example, 
in 
https://developers.google.com/protocol-buffers/docs/cpptutorial#writing-a-message
 
the code reads

tutorial::Person::PhoneNumber* phone_number = person->add_phone();

but it should read

tutorial::Person::PhoneNumber* phone_number = person->add_phones();

and

PromptForAddress(address_book.add_person());

should be

PromptForAddress(address_book.add_people());


Similarly, 
in 
https://developers.google.com/protocol-buffers/docs/cpptutorial#reading-a-message
 
the code reads

for (int i = 0; i < address_book.person_size(); i++) {

but it should read

for (int i = 0; i < address_book.people_size(); i++) {

and

const tutorial::Person& person = address_book.person(i);

should be

const tutorial::Person& person = address_book.people(i);


Moreover, I would consider adding

syntax = "proto2"

to the top of 
https://developers.google.com/protocol-buffers/docs/cpptutorial#defining-your-protocol-format,
 
so that no scary warning is printed if one installs a recent version of 
protobuf.


I would have submitted these changes as a proper PR, but I couldn't find 
the repo that generates the documentation at 
https://developers.google.com/protocol-buffers/. Does it exist? If so, I'd 
be happy to convert this email to a PR.

Cheers,
Jacopo

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to