standards/51292: [PATCH] add ecvt()/fcvt()/gcvt() functions (SUSv3)

Alexey Zelkin phantom at FreeBSD.org.ua
Fri Apr 25 11:00:26 PDT 2003


The following reply was made to PR standards/51292; it has been noted by GNATS.

From: Alexey Zelkin <phantom at FreeBSD.org.ua>
To: "Sergey A. Osokin" <osa at freebsd.org.ru>
Cc: FreeBSD-gnats-submit at 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)
 


More information about the freebsd-standards mailing list