14. Function Overloading

Question.5

A developer writes three send() overloads, each containing identical 50-line formatting logic followed by a type-specific UART write at the end:

void send(int val)    { /* 50 lines */ uart_write_int(val); }
void send(float val)  { /* same 50 lines */ uart_write_float(val); }
void send(double val) { /* same 50 lines */ uart_write_double(val); }

What is the firmware cost of this approach?

Need Help? Refer to the Quick Guide below

Select Answer