[P4-dev] (P4-16) About header_union behavior

Nate Foster jnfoster at cs.cornell.edu
Thu Apr 20 14:14:43 EDT 2017


>
> (I've recently tested the latest version of the compiler and found that
> extracting or emitting individual header fields is no longer acceptable.
> The compiler demands the parameter for extract() to be header, stack or
> union. I assumed unions were really being implemented into the language, so
> I snooped the project files and found the header_union construct.)
>

Header unions are still being designed and are tagged as an experimental
feature in the course code. We are hoping to finalize and release the
design and implementation next month.


> Let's say I extract into a. If I then read/write to b.fixedF, can I expect
> it to yield equivalent results as if I were reading/writing to
> a.fixedField?


No. The current design is more like a tagged union.


> Also, will header_union have an isValid() method? (currently they don't
> seem to have one)


Not currently. Is there a strong reason for having one?

-N
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170420/dd0a7251/attachment-0002.html>


More information about the P4-dev mailing list