Enums are signed, yes.

I would suggest not defining constants in .proto files at all.  There isn't
really any good way of doing it.  Enums really aren't designed to be used as
numeric constants (especially in Java where they aren't even numeric), but
default values are also a pretty awkward way to do it.

On Mon, Feb 14, 2011 at 9:15 AM, maxw <mwindi...@videotron.ca> wrote:

> Hello,
>
> I didn't find crystal-clear confirmation in the documentation, but it
> looks like enum values are considered _signed_ 32-bit integers.  When
> I try to assign 4294967295 to an enum value in a .proto file, protoc
> complains.  Is there any way to have unsigned 32-bit integer
> constants?
>
> I did find on this forum a suggestion ("Issue 60"), which basically
> declares a "Constants" message, with fields that have default values -
> those default values can then be retrieved.  This does work, and also
> has the benefit of allowing more types of constants (than just 32-bit
> integers).
>
> The dilemma that I'm facing is what should be the guideline to choose
> between enum and this default value trick?  Would it be considered
> "bad form" to mix both styles?
>
> Thank you!
>
> --
> 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
> protobuf+unsubscr...@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 protobuf@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