3 ms·
>> indeed, I have seen functions that contain only one line of code. Even if that is intended for reuse, it makes no sense IMHO it can make a lot of sense. In
by amag 13y ago
>> indeed, I have seen functions that contain only one line of code. Even if that is intended for reuse, it makes no sense
IMHO it can make a lot of sense. In many cases you can clearly specify the intention of that one line by putting it in a function with an appropriate name. Just look at the example from the OP:
void HandleNop() {
SPIDataPut(SPI0_BASE, HOST_REPLY_POSACK);
}
When you want to handle a NOP, you're not interested in how that NOP is handled, you just want it handled...:)