@@ -2287,8 +2287,9 @@ one bit long field. This declaration introduces a new identifier in the
2287
2287
current scope; the type can be referred to using this identifier. A header is
2288
2288
similar to a `struct` in C, containing all the specified fields. However, in
2289
2289
addition, a header also contains a hidden Boolean "validity" field. When the
2290
- "validity" bit is `true` we say that the "header is valid". When a header is
2291
- created its "validity" bit is automatically set to `false`. The "validity"
2290
+ "validity" bit is `true` we say that the "header is valid". When a local
2291
+ variable with a header type is
2292
+ declared, its "validity" bit is automatically set to `false`. The "validity"
2292
2293
bit can be manipulated by using the header methods `isValid()`, `setValid()`,
2293
2294
and `setInvalid()`, as described in Section [#sec-ops-on-hdrs].
2294
2295
@@ -4700,9 +4701,10 @@ optInitializer
4700
4701
;
4701
4702
~ End P4Grammar
4702
4703
4703
- Variable declarations without an initializer are uninitialized (except for header
4704
- stacks, which have their `nextIndex` counter initialized to `0`,
4705
- as discussed in [#sec-expr-hs]). The language places few restrictions on
4704
+ Variable declarations without an initializer are uninitialized (except for
4705
+ headers and other header-related types, which are initialized to invalid in the
4706
+ same way as described for direction `out` parameters in Section
4707
+ [#sec-calling-convention]). The language places few restrictions on
4706
4708
the types of the variables: most P4 types that can be written
4707
4709
explicitly can be used (e.g., base types, `struct`, `header`,
4708
4710
header stack, `tuple`). However, it is impossible to declare variables with types
0 commit comments