On Mon, Aug 26, 2024 at 09:55:42AM +0200, Stefano Brivio wrote:On Mon, 26 Aug 2024 15:27:59 +1000 David Gibson <david(a)gibson.dropbear.id.au> wrote:Huh. Ok, I'm just wrong. For some reason I thought the braces were required by C for do while.On Fri, Aug 23, 2024 at 12:14:22AM +0200, Stefano Brivio wrote: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 <stdio.h> int main() { int a = 3; do printf("%i\n", a--); while (a);On Thu, 15 Aug 2024 17:50:22 +0200 Laurent Vivier <lvivier(a)redhat.com> wrote:[snip]Unlike if, while or for, I'm pretty sure the braces are mandatory for do {} while.+ 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.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