From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32297 invoked by alias); 10 Mar 2014 02:01:56 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 32286 invoked by uid 89); 10 Mar 2014 02:01:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Mar 2014 02:01:53 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WMpXJ-0001O0-6R from Yao_Qi@mentor.com ; Sun, 09 Mar 2014 19:01:49 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 9 Mar 2014 19:01:49 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Sun, 9 Mar 2014 19:01:48 -0700 Message-ID: <531D1C80.5000707@codesourcery.com> Date: Mon, 10 Mar 2014 02:01:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Pedro Alves CC: Joel Brobecker , Subject: Re: [PATCH 2/4] Error on bad count number References: <1394023608-10761-1-git-send-email-yao@codesourcery.com> <1394023608-10761-3-git-send-email-yao@codesourcery.com> <20140305142939.GB16858@adacore.com> <531749BA.8050806@redhat.com> <5318456D.3010709@codesourcery.com> <53186842.9030704@redhat.com> <5319938B.60402@codesourcery.com> <5319C931.9090907@redhat.com> In-Reply-To: <5319C931.9090907@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00223.txt.bz2 On 03/07/2014 09:27 PM, Pedro Alves wrote: > On 03/07/2014 09:38 AM, Yao Qi wrote: >> On 03/06/2014 08:21 PM, Pedro Alves wrote: >>>> AFAICS, get_number handles negative numbers. E.g., >>>> >> Yes, get_number handles negative, but is it expected for get_number >> to handle negative? > > Nothing in a name like "get number" suggests to me only positive > numbers would be returned. I think it should be up to the You didn't address the second half of my comments that get_number_or_range errors on negative number. > caller to handle whether the returned value is valid in > that context. > This is sort of what I want to do. I'd like to restrict get_number and get_number_or_range to only handle non-negative number, and return negative number as error code. The callers of get_number or get_number_or_range can decide to emit warning or error in their own context. Checking how char pointer pointer advanced can only tell a boolean state about error is encountered or not, but no details of the type of the error. I want to use get_number in mi_cmd_break_commands, and returns error code about "not-a-number" or "junk at the end" respectively. -- Yao (齐尧)