Code Room
Code reviewHard
Question
Review this C++ routine that finds the max of a sensor reading buffer.
A dropped sensor occasionally writes a NaN into the buffer. Downstream code gates an actuator when `maxReading(v)` exceeds a threshold.
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.
Learn the concepts
double maxReading(const std::vector<double>& v) { double best = -std::numeric_limits<double>::infinity(); for (double x : v) { if (x > best) { best = x; } } return best;}Run or narrate your approach, then ask the coach.