Panics, traps, and undefined behavior

F-PANIC-V4-3hard

Never wrap the hall count

Repair the control-desk request processor: report script positions outside the scene list, isolate each failed seat request, then encode arrival increments without wrapping the stored one-octet total.

What needs to change

Repair admit so the event encoder refuses an increment that would make its one-octet total unrepresentable.

Reproduce

  1. Build clang++ -std=c++2c -Wall -Wextra -pedantic main.cpp -o main, then run ./main with stdin. Use Sample groups and compare the retained total after the third increment.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its headers, readRows, the std::uint8_t hall counter, admit and main.

Input: one arrival-count increment per line. The event schema stores hall as an unsigned octet; in hall is its retained report tag. Refusing an increment changes no encoded state and makes no venue-capacity decision.

Input has at most 50 records, one per LF/CRLF line. ASCII spaces/tabs separate fields and ASCII spaces/tabs/CR frame a line; blank framed lines are ignored. A line is at most 4096 bytes. The supplied reader receives valid fields.

A group token is an optional plus followed by ASCII decimal digits, with value 0..10000. Leading zeros are allowed. The unsigned octet stores only the retained total 0..255.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in