I'm writing the folowing function:
void SPI_TransmitReceive(const uint8_t* txbuf, uint8_t* rxbuf, size_t size);
And calling it with the same buf for tx and rx:
uint8_t mybuf[200];
SPI_TransmitReceive(mybuf, mybuf, 200);
Will there be an undefined behavior?
UPD: To clarify the question. Assume that:
void SPI_TransmitReceive(const uint8_t* txbuf, uint8_t* rxbuf, size_t size) {
std::memmove(rxbuf, srcbuf, size);
}
cppreference says that memmove may lead to UB if regions are overlapping. Is it a typo?