msvcp90: Add complex_float << implementation

Piotr Caban piotr at codeweavers.com
Fri Aug 15 05:36:29 CDT 2014


On 08/15/14 12:18, YongHao Hu wrote:
> I tried to fix this problem and and the result is below.
> -        basic_streambuf_char_sputc(base->strbuf, '(');
> +//        basic_streambuf_char_sputc(base->strbuf, '(');
> +        basic_ostream_char_print_ch(ostr, '(');
> After this change, the problem is solve. And other cout format like
> setw() and setfill() tests are normal.
> However, I am considering an issue now.
> +//       basic_ostream_char_print_double(ostr, val->real);
>           num_put_char_put_double(numput, &dest, dest, &base->base,
> basic_ios_char_fill_get(base), val->real);
> + //       basic_ostream_char_print_ch(ostr, ',');
>           basic_streambuf_char_sputc(base->strbuf, ',');
> + //       basic_ostream_char_print_double(ostr, val->imag);
>           num_put_char_put_double(numput, &dest, dest, &base->base,
> basic_ios_char_fill_get(base), val->imag);
> + //       basic_ostream_char_print_ch(ostr, ')');
>           basic_streambuf_char_sputc(base->strbuf, ')');
>
> I thought the difference between basic_ostream_char_print_xxx and
> num_put_char_put_xx is that
> the former create and destroy sentry. There is no doubt that it will
> decrease the efficency.
> On the other hand, my fix seems not so right.
> Could you please give me some advice?
This code is still not working well with the test I've sent. The width 
should affect whole complex value, not only the first character (it will 
be easier to see it if you set width to 5, in this case your 
implementation will add 4 spaces, native will add 0 spaces).

Probably the easiest way to implement it is to write whole complex to 
temporary ostringstream and print it using basic_ostream_char_print_str.

Cheers,
Piotr



More information about the wine-devel mailing list