qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: nee <nia.alarie@gmail.com>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@gmail.com>,
	Jim Mussared <jim@groklearning.com>,
	Joel Stanley <joel@jms.id.au>,
	kraxel@redhat.com
Subject: Re: [Qemu-devel] [PATCH] audio: Convert use of atoi to qemu_strtoi
Date: Mon, 19 Mar 2018 10:08:47 -0500	[thread overview]
Message-ID: <aafd7703-47a1-981b-095d-cba47e0bf054@redhat.com> (raw)
In-Reply-To: <CA+k8WDrcRro0ifJC1AEKeyapMGL4VUbD05D4wGN6T9ySy0Wh7Q@mail.gmail.com>

On 03/19/2018 10:01 AM, nee wrote:
> On Mon, Mar 19, 2018 at 2:47 PM, Eric Blake <eblake@redhat.com> wrote:
>> On 03/16/2018 09:40 AM, Nia Alarie wrote:
>>>
>>> If qemu_strtoi indicates an error, return the default value.
>>
>>
>> Would it be better to diagnose the error instead of silently returning a
>> default value?
>>

> 
> Possibly, while writing these patches I was just going by what was
> already there. I can see how that would be good.
> 
> Should the code provide a warning to the user and continue with the
> default, or provide the warning and exit? And is it more correct to
> use dolog() or AUD_log() in this context?

I'll defer to the audio maintainer's opinion on what might be best here. 
  But my personal preference is that if the only time you can give 
invalid input is via a bad command line argument, then print the error 
and exit immediately (the VM never starts), so that the user can then 
fix their bad command line and get the value they wanted instead of 
silently running with a different value all because of a typo that 
caused us to fail to parse a number.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

      reply	other threads:[~2018-03-19 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-16 14:40 [Qemu-devel] [PATCH] audio: Convert use of atoi to qemu_strtoi Nia Alarie
2018-03-19 14:47 ` Eric Blake
2018-03-19 15:01   ` nee
2018-03-19 15:08     ` Eric Blake [this message]

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=aafd7703-47a1-981b-095d-cba47e0bf054@redhat.com \
    --to=eblake@redhat.com \
    --cc=jim@groklearning.com \
    --cc=joel@jms.id.au \
    --cc=kraxel@redhat.com \
    --cc=nia.alarie@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /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.
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 NNTP newsgroup(s).