help with simple? program

Paolo Carlini pcarlini@suse.de
Mon Sep 20 09:10:00 GMT 2004


Jerry Quinn wrote:

>int main()
>{
>  const money_put<char>& mp = use_facet<money_put<char> >(locale("en_US"));
>  mp.put(cout, false, cout, cout.fill(), 45333);
>}
>  
>
Hi Jerry. I see at least one extremely serious problem in your (too 
short ;) snippet:
locale("en_US") is a *temporary* that goes out of scope way too soon: 
see Langer
& Kreft p.273 for details.

Why don't you take inspiration from our money_put testsuite?

Thanks,
Paolo.



More information about the Libstdc++ mailing list