From owner-freebsd-current@FreeBSD.ORG Thu Jun 21 15:42:49 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9E47E1065781 for ; Thu, 21 Jun 2012 15:42:49 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 2BA4B8FC08 for ; Thu, 21 Jun 2012 15:42:49 +0000 (UTC) Received: by eeke49 with SMTP id e49so413427eek.13 for ; Thu, 21 Jun 2012 08:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Ee1+gzJCjdqrIIZ1YSilhbOrBkxOv9HpNp0s9LlpHvA=; b=ae6/5v1qeybt7t5tjp8ZkhNccyxIEuVANUtZNESrbWmuKAGQJOxsM+9+zQoIRvJeaz +yu9SMNVht8v8bMJg6xijlBCoqMzmDEECJlF0NqDd1eTpwtcU/dY4gw38vRKwZA6xv9D z3ydG0b8tH58JgizynnEvQ/NzblIEfRJCC5/rrq+g+PX3faKaAwfDQ1kUpBNPKT7IMV2 y6D5NA7mhaWT3Q3AqmuRA6ele6wVWlBbLlZLj3dbYjPQZ+94bHXwUXNun3ExqKiQahAL EF6VZ7USivD/sCvF1qPCS8Gu/kaFSdiFdogo3pvPF9pVQ3VErSXb7nnZJgckl9XYJDHU zDOg== Received: by 10.14.127.132 with SMTP id d4mr6009427eei.116.1340293368365; Thu, 21 Jun 2012 08:42:48 -0700 (PDT) Received: from Groseille.malikania.fr (197.21.102.84.rev.sfr.net. [84.102.21.197]) by mx.google.com with ESMTPS id u16sm104004908eeb.16.2012.06.21.08.42.46 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 08:42:47 -0700 (PDT) Message-ID: <4FE340FF.80406@gmail.com> Date: Thu, 21 Jun 2012 17:42:55 +0200 From: David Demelier User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120602 Thunderbird/12.0.1 MIME-Version: 1.0 To: Sergey Kandaurov References: <4FE315B6.9020102@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-current@freebsd.org Subject: Re: mbstowcs(3) may not return -1 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 15:42:49 -0000 On 21/06/2012 14:55, Sergey Kandaurov wrote: > On 21 June 2012 16:38, David Demelier wrote: >> Hello, >> >> While reading the manpage of mbstowcs I noticed an error in the RETURN >> VALUES : >> >> The mbstowcs() function returns the number of wide characters converted, >> not counting any terminating null wide character, or -1 if an invalid >> multibyte character was encountered. >> >> Since size_t is unsigned, it can't returns -1. > > It returns (size_t)(-1). > I don't know how is it correct, but this conforms to C spec. > Mm, if I understand well, since it is cast to size_t, I think the return value will be SIZE_MAX - 1 then, right? -- David Demelier