Checkpoint: Append-Only Packet
Challenge on lesson: Checkpoint: Struct Contracts Across Versions
CHALLENGE
Difficulty: advanced+25 XP
In your editor: struct frame { unsigned char tag; unsigned short seq; unsigned int payload; };. Implement:
1. void frame_report(size_t *off_seq, size_t *off_payload, size_t *size) โ offsetof/sizeof measured, not hardcoded.
2. Define struct frame_v2 { unsigned char tag; unsigned short seq; unsigned int payload; unsigned long long ts; }; and int frame_prefix_stable(void) โ 1 iff tag/seq/payload offsets are identical between the versions (offsetof-verified).
3. unsigned long long sum_upto(int n, ...) โ totals n unsigned ints passed variadic.
Press Submit to check your solution.
Back to lesson: Checkpoint: Struct Contracts Across Versions