documented money_get example output doesn't match real output -------------------------------------------------------------
Key: STDCXX-411 URL: https://issues.apache.org/jira/browse/STDCXX-411 Project: C++ Standard Library Issue Type: Bug Components: Documentation Affects Versions: 4.1.3 Reporter: Mark Brown -----Original Message----- From: [EMAIL PROTECTED] Sent: Fri, 11 May 2007 16:54:37 -0600 To: stdcxx-dev@incubator.apache.org Subject: Re: money_get example output Mark Brown wrote: > Hi all, > > Out of curiosity I tried compiling and running the example from the money_get > page with stdcxx on Linux but the output is different than the documentation > shows. So I tried it with g++ and the output is different still. Is the > documentation incorrect or is there a bug in the library? Can someone explain > what the correct output should be? > > $ ./money_get-stdcxx > $100.02 --> --> 0e-2175 > $ ./money_get-g++ > $100.02 --> --> 1.432e-3754 > > The example program is on this page: > http://incubator.apache.org/stdcxx/doc/stdlibref/money-get.html I think the problem is that the example code on the documentation page doesn't set the locale. The real example (i.e., the actual program) does: it sets it to the English US locale. The code is here: http://svn.apache.org/repos/asf/incubator/stdcxx/trunk/examples/manual/moneyget.cpp The reason why stdcxx and libstdc++ produce different output in the default "C" locale is in all likelihood because the facet fails to store a value in the uninitialized variable and the example ends up writing out bogus bits. Can you please open a new Documentation issue for this? FWIW, copying the source code of each example program into the docs and keeping the two in sync is a maintenance headache. We should find a better way to do this. One possibility for dealing with this is to get rid of the code and replace it with a link to the .cpp file in Subversion. That alone probably isn't the most user-friendly solution. A variation on this approach that might be better is to run a script on the documentation sources after checking them out of Subversion on the Apache Web server and replace the links mentioned above with the up-to-date source code of each example extracted at the same time out of the repository. Can anyone think of any other ways to keep things in sync, or of any further improvements to the process? Martin -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.