OK, thanks. Just to clarify, I don't want access to _has_bits_, but
just to the definition of which bit position corresponds to which
field in the message. I.e., I want the compiler to do this:

#define ATTR1_BIT 1

instead of this:


Then my application can use the ATTR1_BIT definitions to implement it
own tracking of message field characteristics.

Does that change anything?

On Feb 23, 7:18 pm, Kenton Varda <ken...@google.com> wrote:
> Hi Tim,
> On Mon, Feb 23, 2009 at 7:01 PM, <timbla...@gmail.com> wrote:
> > In my application, I have a need to track characteristics of message
> > fields on a field-by-field basis, e.g. has this field changed. This is
> > very much like what is already done in libprotobuf code for tracking
> > whether a field has been set yet. Looking under the hood, I found the
> > _has_bits_, a simple bitfield tracking mechanism, and thought I could
> > reuse this for tracking other characteristics my app is interested in.
> > So far, though, it looks like the bit numbers are hard-coded in the
> > _set_bit/_clear_bit/has_bit method calls. Is there any plan to modify
> > the compiler to define these field bits as constants or at least
> > #defines in the generated c++ header file?
> _has_bits_ is an internal (private) implementation detail.  We don't plan to
> make it publicly-accessible.
> Aside from this general question, is there another simple way you can
> > think of to track what fields have changed? I couldn't find anything
> > in the API that allowed diff'ing two instances of the same message
> > class. (I also couldn't find any equality operators, so had to define
> > that myself; please advise if this was unnecessary.)
> It's not included in the base library, but you could write code to do this
> based on reflection.
> > Thanks,
> > Tim
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 
For more options, visit this group at 

Reply via email to