Hi all,

I'm from the Apache Mesos community and we're working on things that uses 
proto3.
We usually turn on compiler options to report missing values in switch 
statements,
and don't do a "default" clause. This gives us the benefit of capturing 
missing enum
values during compile time. However, it seems that for proto3's open enum 
values,
we need to either manually adding those `*_INT_MAX_SENTINEL_DO_NOT_USE_` 
values
in switch statements, or add a default clause to avoid such errors but then 
we lose
the benefit I mentioned above. It seems that the compiler is not clever 
enough
to infer that clauses for those sentinel values are not needed for switch 
statements
that are inside `if(Enum_IsValid(...))` statements.

My question is, what's the best practice if I don't want to add a default 
clause?
Is it safe to add either `*_INT_MAX_SENTINEL_DO_NOT_USE_` symbols
or `google::protobuf::kint32max` into switch statements, such that these 
won't
remain unchanged in future versions of protobuf library? Or is there a 
better way
to address this?

Thanks,
Chun-Hung

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/bea0dbdf-70da-478b-a531-c38c9f11dd62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to