public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/5579: Problems with money_get
@ 2002-02-02 21:46 Martin Sebor
  0 siblings, 0 replies; 4+ messages in thread
From: Martin Sebor @ 2002-02-02 21:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/5579; it has been noted by GNATS.

From: Martin Sebor <sebor@roguewave.com>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/5579: Problems with money_get
Date: Sat, 02 Feb 2002 22:53:35 -0700

 Peter Schmid wrote:
 > 
 > >Number:         5579
 > >Category:       libstdc++
 > >Synopsis:       Problems with money_get
 ...
 > According to Table 14.15 on page 714 from the book "The C++ Standard
 > Library" by Josuttis when pattern is set to { symbol, none, sign,
 > value } $1234.54 should be legal input. But the following test case tmon
 > does not work. I apologize if I made a mistake.
 
 The locale containing your punctuation facet needs to be imbued in
 the stream passed to money_get<>::get () in order for the function
 to find it. Otherwise the default moneypunct (with an empty curr_symbol)
 is used.
 
 Also, the name of the function is do_thousands_sep(). The one in your
 facet is misspelled (it's missing an 's' at  the end).
 
 Finally, the program needs to #include <locale> to bring moneypunct
 et al into the namespace. Other than that, it seems correct but I
 can't tell you if it works with the latest libstdc++ or not. It does
 produce similarly bogus output with the older version that comes with
 gcc 3.0.1.
 
 Regards
 Martin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/5579: Problems with money_get
@ 2002-02-04 12:01 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2002-02-04 12:01 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, paolo, schmid

Synopsis: Problems with money_get

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Mon Feb  4 12:00:52 2002
State-Changed-Why:
    Fixed with:
    http://gcc.gnu.org/ml/gcc-patches/2002-02/msg00257.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5579


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: libstdc++/5579: Problems with money_get
@ 2002-02-03 15:15 paolo
  0 siblings, 0 replies; 4+ messages in thread
From: paolo @ 2002-02-03 15:15 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, schmid

Synopsis: Problems with money_get

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sun Feb  3 15:15:21 2002
Responsible-Changed-Why:
    Analyzed.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sun Feb  3 15:15:21 2002
State-Changed-Why:
    Confirmed (on a test case, slighlty amended according to
    Martin Sebor indications). Patch posted:
      http://gcc.gnu.org/ml/libstdc++/2002-02/msg00005.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5579


^ permalink raw reply	[flat|nested] 4+ messages in thread

* libstdc++/5579: Problems with money_get
@ 2002-02-02 17:46 Peter Schmid
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Schmid @ 2002-02-02 17:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5579
>Category:       libstdc++
>Synopsis:       Problems with money_get
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 02 17:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Peter Schmid
>Release:        3.1 20020202 (experimental)
>Organization:
TU Darmstadt
>Environment:
System: Linux kiste 2.4.17 #7 Thu Jan 3 17:21:51 CET 2002 i686 unknown
Architecture: i686
Glibc 2.2.4 + patches
Linux 2.4.17
binutils 2.11.92.0.12.3
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads --enable-languages=c,c++,f77,objc
>Description:
According to Table 14.15 on page 714 from the book "The C++ Standard
Library" by Josuttis when pattern is set to { symbol, none, sign,
value } $1234.54 should be legal input. But the following test case tmon
does not work. I apologize if I made a mistake.

>How-To-Repeat:
Source code tmon.C

#include <string>
#include <sstream>
#include <iostream>

class My_money_io : public std::moneypunct<char,false>
{
public:
  explicit My_money_io(size_t r = 0): std::moneypunct<char,false>(r) { }
  char_type do_decimal_point() const { return '.'; }
  char_type do_thousand_sep() const { return ','; }
  std::string do_grouping() const { return "\003\003\003"; }
  
  std::string do_curr_symbol() const { return "$"; }
  std::string do_positive_sign() const { return ""; }
  std::string do_negative_sign() const { return "-"; }
  
  int do_frac_digits() const { return 2; }

  pattern do_pos_format() const
  {
    static pattern pat = { { symbol, none, sign, value } };
    return pat;
  }

  pattern do_neg_format() const
  {
    static pattern pat = { { symbol, none, sign, value } };
    return pat;
  }

};

int main ()
{
  using namespace std;
  typedef istreambuf_iterator<char> InIt;

  locale loc(locale::classic(), new My_money_io);

  string buffer("$1234.56");
  bool intl = false;

  InIt iend;
  ios_base::iostate err = ios::goodbit;
  string val;
  long double lval;

  cerr << "good eof fail bad "
       << ios::goodbit << " "
       << ios::eofbit << " "
       << ios::failbit << " "
       << ios::badbit << endl;

  const money_get<char,InIt>& mg  =
    use_facet<money_get<char, InIt> >(loc);

  {
    istringstream fmt(buffer);
    InIt ibeg(fmt);
    mg.get(ibeg,iend,intl,fmt,err,val);
    cerr << "iostates:" << err << '\n'; 
  }
  {
    istringstream fmt(buffer);
    InIt ibeg(fmt);
    mg.get(ibeg,iend,intl,fmt,err,lval);
    cerr << "iostatel:" << err << '\n'; 
  }
  cout << "buffer:" << buffer << " val:" << val  
       << " lval:" << lval << endl;
}

g++ -v -o tmon tmon.C -W -Wall
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --enable-shared --disable-nls --enable-threads --enable-languages=c,c++,f77,objc
Thread model: posix
gcc version 3.1 20020202 (experimental)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ tmon.C -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase tmon.C -W -Wall -version -o /tmp/ccGMffsb.s
GNU CPP version 3.1 20020202 (experimental) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20020202 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 3.1 20020202 (experimental).
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/i686-pc-linux-gnu
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../../../i686-pc-linux-gnu/bin/as -V -Qy -o /tmp/ccH1OGSt.o /tmp/ccGMffsb.s
GNU assembler version 2.11.92.0.12.3 (i686-pc-linux-gnu) using BFD version 2.11.92.0.12.3 20011121
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o tmon /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1 -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../../../i686-pc-linux-gnu/lib -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../.. /tmp/ccH1OGSt.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtend.o /usr/lib/crtn.o

./tmon
good eof fail bad 0 2 4 1
iostates:4
iostatel:4
buffer:$1234.56 val: lval:-5.73401e-247

>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-04 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-02 21:46 libstdc++/5579: Problems with money_get Martin Sebor
  -- strict thread matches above, loose matches on Subject: below --
2002-02-04 12:01 paolo
2002-02-03 15:15 paolo
2002-02-02 17:46 Peter Schmid

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).