I recently saw this snippet of code:
static HAL_StatusTypeDef Program_Flash_Page(uint32_t const page_address, \
void* const pBufferData, uint32_t const nBufferSize) {
uint32_t Address = page_address;
uint64_t *DATA_64 = (uint64_t *) pBufferData;
while (Address < (page_address + nBufferSize)) {
if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, *DATA_64) == \
HAL_OK) {
Address = Address + 8;
DATA_64++;
}
else {
return HAL_ERROR;
}
}
return HAL_OK;
}
As you can see, backslashes were used to present a list of arguments and a logical condition in multiple lines.
As I learned from Kernighan and Ritchie (2nd edition, paragraph A.12.2, p.207), "lines that end with the backslash \ character are folded by deleting the backslash and the following newline character" during preprocessing.
What remained unclear to me is that if this syntax is obligatory or if one can just use a new line character (hit the enter button) while coding.