Issue Details (XML | Word | Printable)

Key: STDCXX-411
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Martin Sebor
Reporter: Mark Brown
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

documented money_get example output doesn't match real output

Created: 12/May/07 03:57 PM   Updated: 12/May/07 06:57 PM
Return to search
Component/s: Documentation
Affects Version/s: 4.1.3
Fix Version/s: 4.2.0

Time Tracking:
Not Specified

Resolved: 12/May/07 06:57 PM
Resolution Date: 12/May/07 06:57 PM


 Description  « Hide
----Original Message----
From: sebor@roguewave.com
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



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Martin Sebor made changes - 12/May/07 04:38 PM
Field Original Value New Value
Assignee Martin Sebor [ sebor ]

Martin Sebor added a comment - 12/May/07 06:57 PM
The HTML page now matches the example program (except for some insignificant details).

Martin Sebor made changes - 12/May/07 06:57 PM
Resolution Fixed [ 1 ]
Fix Version/s 4.2 [ 12311945 ]
Status Open [ 1 ] Resolved [ 5 ]