public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Laurent Vivier <lvivier@redhat.com>, passt-dev@passt.top
Subject: Re: [PATCH v3 3/4] vhost-user: introduce vhost-user API
Date: Mon, 26 Aug 2024 09:55:42 +0200	[thread overview]
Message-ID: <20240826095542.6ebe2410@elisabeth> (raw)
In-Reply-To: <ZswSX_L2SpXnfh3b@zatzit.fritz.box>

On Mon, 26 Aug 2024 15:27:59 +1000
David Gibson <david@gibson.dropbear.id.au> 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 <lvivier@redhat.com> 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 <stdio.h>

int main()
{
    int a = 3;

    do
        printf("%i\n", a--);
    while (a);

    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.

-- 
Stefano


  reply	other threads:[~2024-08-26  7:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15 15:50 [PATCH v3 0/4] Add vhost-user support to passt. (part 3) Laurent Vivier
2024-08-15 15:50 ` [PATCH v3 1/4] packet: replace struct desc by struct iovec Laurent Vivier
2024-08-20  0:27   ` David Gibson
2024-08-15 15:50 ` [PATCH v3 2/4] vhost-user: introduce virtio API Laurent Vivier
2024-08-20  1:00   ` David Gibson
2024-08-22 22:14   ` Stefano Brivio
2024-08-15 15:50 ` [PATCH v3 3/4] vhost-user: introduce vhost-user API Laurent Vivier
2024-08-22 22:14   ` Stefano Brivio
2024-08-26  5:27     ` David Gibson
2024-08-26  7:55       ` Stefano Brivio [this message]
2024-08-26  9:53         ` David Gibson
2024-08-26  5:26   ` David Gibson
2024-08-26 22:14     ` Stefano Brivio
2024-08-27  4:42       ` David Gibson
2024-09-05  9:58     ` Laurent Vivier
2024-08-15 15:50 ` [PATCH v3 4/4] vhost-user: add vhost-user Laurent Vivier
2024-08-22  9:59   ` Stefano Brivio
2024-08-22 22:14   ` Stefano Brivio
2024-08-23 12:32   ` Stefano Brivio
2024-08-20 22:41 ` [PATCH v3 0/4] Add vhost-user support to passt. (part 3) Stefano Brivio
2024-08-22 16:53   ` Stefano Brivio
2024-08-23 12:32     ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240826095542.6ebe2410@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).