[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [Qemu-devel] [PATCH 07/14] qemu-io: Don't print NULL w
From: |
Jeff Cody |
Subject: |
Re: [Qemu-stable] [Qemu-devel] [PATCH 07/14] qemu-io: Don't print NULL when open without non-option arg fails |
Date: |
Tue, 27 May 2014 21:00:28 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, May 27, 2014 at 08:59:20AM -0600, Eric Blake wrote:
> On 05/27/2014 04:41 AM, Benoît Canet wrote:
>
> >> - fprintf(stderr, "%s: can't open device %s: %s\n", progname,
> >> name,
> >> + fprintf(stderr, "%s: can't open%s%s: %s\n", progname,
> >> + name ? " device " : "", name ?: "",
> >
> > name ?: "" seems to be a GNU C extension: see
> > http://en.wikipedia.org/wiki/%3F:#C
> >
> > Don't we want this code to work on most compilers ?
>
> It already works on all 2 compilers we actively support (gcc and clang),
> and this is not the first instance of this extension in the code base:
>
> $ git grep '\?:' | wc
> 210 1081 15271
>
> If it ever becomes a real portability problem to someone trying to port
> to another compiler, it would be a search-and-replace fix to the whole
> tree at that time.
>
A few areas we've used the extension '?:' would have side affects if
changed to the traditional A ? A : B format, as well.