"protoc" proto3 c++ map size method return type?

5 views
Skip to first unread message

CoinOperated

unread,
Jan 28, 2026, 11:09:38 AM (2 days ago) Jan 28
to Protocol Buffers
Greetings,
I have a nuisance issue with the protoc generator that i am trying to resolve and hope that the group might have a solution.  Protoc is generation inline methods that provide the internal size of a protobuf map that is generated as a  C+ 'int' return instead of the size_t type of the C++ map i.e.:

// map<uint32, .My.Grpc.Map_t> myMap = 2;
inline int MyNameSpace::_internal_mymap_size() const {
  return _internal_mymap().size(); 
}

This generates 'possible data loss' type conversion warning messages during compilations that i prefer to track during system development/builds.  For consistency  (hobgoblin), my preference would be to see protoc generate C++ code using size_t as the return type for the capacity of the protobuf generated Map class. Any suggestions?
Reply all
Reply to author
Forward
0 new messages