From owner-freebsd-standards@FreeBSD.ORG Fri Apr 25 11:00:26 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 16DF937B401 for ; Fri, 25 Apr 2003 11:00:26 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id B129543F93 for ; Fri, 25 Apr 2003 11:00:25 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h3PI0OUp061153 for ; Fri, 25 Apr 2003 11:00:24 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h3PI0OU5061150; Fri, 25 Apr 2003 11:00:24 -0700 (PDT) Date: Fri, 25 Apr 2003 11:00:24 -0700 (PDT) Message-Id: <200304251800.h3PI0OU5061150@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Alexey Zelkin Subject: Re: standards/51292: [PATCH] add ecvt()/fcvt()/gcvt() functions (SUSv3) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Alexey Zelkin List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2003 18:00:26 -0000 The following reply was made to PR standards/51292; it has been noted by GNATS. From: Alexey Zelkin To: "Sergey A. Osokin" Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: standards/51292: [PATCH] add ecvt()/fcvt()/gcvt() functions (SUSv3) Date: Fri, 25 Apr 2003 21:05:09 +0300 hi, On Fri, Apr 25, 2003 at 07:33:06PM +0400, Sergey A. Osokin wrote: > BTW > if (setlocale(LC_NUMERIC, NULL) == NULL) { > radix = '.'; > n_sign = '-'; > p_sign = '+'; > } else { > lc = localeconv(); > radix = *lc->decimal_point; > n_sign = *lc->negative_sign; > p_sign = *lc->positive_sign; > } > > Correct? No. 1. 'if' statement will never return in this case. It's possible for setlocale() to retrun at 'set' request, but this is 'get' request. And if previously setlocale() was never called, default locale caregory name ("C") will be returned. 2. Even in case if setlocale() was never called, or setlocale() call for LC_NUMERIC category was failed before -- it always will be used default "C" locale settings. They're staticly available from libc. It's are always guaranted that localeconv() will return reasonable values (current or default)