[P4-dev] Suggestion: Adding sizeof

Kamila Součková kamila at ksp.sk
Tue Feb 5 14:17:59 EST 2019


Hello,

While P4's lack of void* all over the place makes the sizeof() operator
known from C not absolutely necessary, I believe it could still be useful
to have it. For example, the protocol I am currently parsing likes to
specify offsets and align things to 8 bytes. Therefore I am finding myself
writing a lot of header definitions followed by `const int my_header_size =
...`. This feels very wrong to me. Unless I am the only person in the world
who needs that, I think adding sizeof() to the language in some future
version might be useful.

Thanks, and best wishes,
Kamila
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20190205/9844188e/attachment.html>


More information about the P4-dev mailing list