On Mon, Aug 26, 2024 at 09:55:42AM +0200, Stefano Brivio wrote: > On Mon, 26 Aug 2024 15:27:59 +1000 > David Gibson wrote: > > > On Fri, Aug 23, 2024 at 12:14:22AM +0200, Stefano Brivio wrote: > > > On Thu, 15 Aug 2024 17:50:22 +0200 > > > Laurent Vivier wrote: > > [snip] > > > > > > + if (sz_payload) { > > > > + do { > > > > + ret = recv(conn_fd, &vmsg->payload, sz_payload, 0); > > > > + } while (ret < 0 && (errno == EINTR || errno == EAGAIN)); > > > > > > No need for curly brackets, it's a one-line statement. > > > > Unlike if, while or for, I'm pretty sure the braces are mandatory for > > do {} while. > > What do you mean by mandatory? This is not covered in any special way > by the kernel coding style documentation, and that statement is not a > compound statement: > > $ cat dowhile.c > #include > > int main() > { > int a = 3; > > do > printf("%i\n", a--); > while (a); Huh. Ok, I'm just wrong. For some reason I thought the braces were required by C for do while. > > return 0; > } > $ gcc -Wall -Wextra -pedantic -std=c89 -o dowhile dowhile.c > $ ./dowhile > 3 > 2 > 1 > > but sure, if you suggest that curly brackets improve clarity here, I > have nothing against them. Not what I was getting at, but I do think that's true. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson