qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] audio: Convert use of atoi to qemu_strtoi


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] audio: Convert use of atoi to qemu_strtoi
Date: Mon, 19 Mar 2018 10:08:47 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 03/19/2018 10:01 AM, nee wrote:
On Mon, Mar 19, 2018 at 2:47 PM, Eric Blake <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]