Why does the isset()
Operator not require Explicit Types?
#617
Unanswered
Danaozhong
asked this question in
Q&A
Replies: 1 comment
-
Thanks pointing this out! I think we forgot to update documentation of The reason why
But I agree that this is a little bit inconsistent. We might think to improve expressions to allow omitting the name prefix if possible, but I am afraid that this will bring even more confusions. Therefore, I just suggest to update documention for now. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The
zserio
specification about bitmasks states the following:This doesn't seem to apply to the
isset()
operator, as the example provided shows that writing the following is possible:return isset(testBitmask, INT);
This example also compiles with
zserio
(tested version 2.11.0).This code does not compile:
return ((testBitmask & INT) == TestBitmask.INT);
The
isset()
example is not within the defining type, but omits the type name and dot. Based on the documentation of bitmask types, I would have expected only the following syntax to be legal:return isset(testBitmask, TestBitmask.INT);
That feels a bit inconsistent to me. Of course, it makes sense that
isset()
can deduce the bitmask type from the first operand, but it seems to contradict the documentation.Beta Was this translation helpful? Give feedback.
All reactions