[P4-dev] Suggestion: Adding sizeof
kamila at ksp.sk
Tue Feb 5 14:27:32 EST 2019
thanks a lot for the pointer! I'm glad it's being considered. Yay!
On Tue, Feb 5, 2019 at 8:23 PM Nate Foster <jnfoster at cs.cornell.edu> wrote:
> Hi Kamila,
> This is being actively discussed by the LDWG. If you have thoughts, please
> weigh in here https://github.com/p4lang/p4-spec/issues/660
> On Tue, Feb 5, 2019 at 2:18 PM Kamila Součková <kamila at ksp.sk> wrote:
>> 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,
>> P4-dev mailing list
>> P4-dev at lists.p4.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the P4-dev