Panics, traps, and undefined behavior

F-PANIC-V4-2medium

Keep booking after a failure

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 runAll so a request that fails is reported and the others still run.

Reproduce

  1. Build clang++ -std=c++2c -Wall -Wextra -pedantic main.cpp -o main, then run ./main with stdin. Use Sample bookings and trace which request reports are reached.

Acceptance criteria

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

Notes

The file contains its headers, readRows, the seating plan, handle and main. handle throws std::out_of_range for unknown rows and seats.

Input: a row letter and a seat number on each line.

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.

Scene and seat numbers are optional plus or minus followed by ASCII decimal digits, with value -10000..10000. Leading zeros are allowed; reports use the numeric value. An out-of-range position is still a valid request to report.

A row code is an opaque valid UTF-8 token of at most 64 bytes, excluding ASCII space/tab and CR/LF record delimiters. BOM, NEL and other token characters remain unchanged. Only exact A and B identify known rows.

The supplied handler uses checked map/vector at(), which throws std::out_of_range. That exception derives from std::exception; no unchecked out-of-range access is executed.

Sign in to open this exercise

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

Sign in