Closed pataei closed 1 year ago
I don't think the error type has to be declared. But members of the error type do need to be declared. It's like error exists but new members can be added to it by error {member1; member2 }
declarations. Likewise for match_kind.
Also where I usually see error
used is as a field of the standard_metadata_t
struct in V1Model. I don't know if that's the kind of use you're looking for though?
Yeah, error
itself doesn't have to be declared but its member does. And yes, standard_metadata_t
is a great example. Thx Ryan!
yw!
In the same vein, you can also declare variables of type match_kind
or error
. Not incredibly useful, but legal.
P4 spec categories
error
andmatch_kind
types asbaseType
, however, they both have to be declared by a P4 program. Here is the grammar forbaseType
anddeclaration
:A quick look through P4 spec and where these types are used resulted only in one example which uses
error
type in arguments:@jnfoster and @hackedy Any other examples of using these types where
baseType
is used?