I am new and want to understand the purpose/usage of default values in
the .proto file. E.g:

test
{
 optional string a 1 [default ="test"];
}

When I create a message object and read the field value, the default
will be displayed:

test thing;
cout<<thing.a();

But when I serialise, write to a file, and inspect the binary message,
the default is absent:

string temp;
thing.SerializeToString(&temp);
ofstream file("wire_message", std::ios::out | std::ios::binary);
file<<temp;
file.close();

If the default values aren't serialised, what is their purpose? What's
the rationale for not serialising them?

Thanks!

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

Reply via email to