120. Copy Semantics-II

Question.7

A developer passes a large config struct by value to an ISR callback:

struct MotorConfig {
   float kp, ki, kd;
   int limits[4];
   uint32_t flags;
}; // ~32 bytes

void motor_isr(MotorConfig cfg) {  // By value!
   apply_pid(cfg);
}

Why is pass-by-value dangerous in an ISR?

Need Help? Refer to the Quick Guide below

Select Answer