Code Room
Code reviewHardcr-g281
Subject Comparator violationsLevel Senior–Staff~20 minCommon in Code quality & review interviewsIndustries Telecom, Software development

Question

Review this C++ receive-window check. `seq` is a sequence number from the wire (uint32_t) and `window` is the configured window size.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewcpp
class Receiver {public:    bool accept(uint32_t seq) {        if (!inWindow(seq, base_, window_)) {            return false;   // drop: out of window        }        deliver(seq);        return true;    }private:    bool inWindow(uint32_t seq, uint32_t base, int window) {        int delta = seq - base;        return delta >= 0 && delta < window;    }    uint32_t base_;   // lowest unacknowledged sequence number    int window_;};
Run or narrate your approach, then ask the coach.