Re: [gtkmm] convert double to char
- From: Chris Vine <chris cvine freeserve co uk>
- To: Paul Davis <paul linuxaudiosystems com>
- Cc: SMS WebMaster <sms 4-sms com>, gtkmm list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] convert double to char
- Date: Sat, 6 Dec 2003 23:31:14 +0000
On Saturday 06 December 2003 10:16 pm, Paul Davis wrote:
[snip]
> all true. however, if you can find me any value of a double that will
> not fit into a 32 character representation, i'd like to see it. in
> addition, snprintf() also makes a buffer overrun impossible in more or
> less the same way. the overhead of stringstreams can be quite
> significant, which is why i tend to avoid using them.
Yes, I realised that it was very unlikely that any practical implementation of
a double would exceed 32 characters in length in written decimal format. I
never use the C-string stream functions, but I am glad that snprintf()
doesn't have the brain dead behaviour of strncpy().
I have not noticed stringstreams being so inefficient, but I have never used
them in performance critical situations (if this was performance critical it
would be better to use gcvt() than s(n)printf() in any event, as the former
doesn't need to resolve which conversion is be carried out at run time).
Have you done any measurements, and is it the libstdc++ 3 streams which
perform poorly?
Chris.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]