Y
Your Name
Hi all,
I run a small engineering company, and our main project is a very large C++
application -- it's actually multiple applications which communicate with
each other over various interfaces (USB, serial, etc).
We're at the point now where we have several developers all working on the
various pieces of C++ code. Some of us are comfortable with Boost, some
use StringStream, and some still use sprintf() and sscanf(). But things
are very inconsistent, and there is too much "glue" code converting between
all the different string representations.
If it matters, our application is largely mathematical, so the bulk of the
string handling that we do is converting floats, ints, and doubles to and
from strings, and we need precise control over the formatting/precision.
Much of this is to/from text files, but some of it is from Win32 objects,
like MFC controls (edit boxes, etc).
I want to choose a standard and convert all of our existing code. The
choices I'm considering are:
1) std::string, with Boost::format and Boost::tokenizer
2) std::string, with StringStream
3) MFC's CString (I don't know the sscanf() equivalent here)
4) The new sprintf_s() and sscanf_s() "secure" functions available in
Visual Studio
5) Writing a custom string class, along with formatting functions
6) Writing custom formatting functions that work with std::string
I'm sure there's no one-size-fits-all answer to this problem, so I'm
looking for general feedback. On the other hand, this is such a
fundamental problem in application development that I'm a little surprised
there's no universally accepted solution. Or maybe there is and I just
didn't get the memo.
Thanks for suggestions and opinions.
Pat
I run a small engineering company, and our main project is a very large C++
application -- it's actually multiple applications which communicate with
each other over various interfaces (USB, serial, etc).
We're at the point now where we have several developers all working on the
various pieces of C++ code. Some of us are comfortable with Boost, some
use StringStream, and some still use sprintf() and sscanf(). But things
are very inconsistent, and there is too much "glue" code converting between
all the different string representations.
If it matters, our application is largely mathematical, so the bulk of the
string handling that we do is converting floats, ints, and doubles to and
from strings, and we need precise control over the formatting/precision.
Much of this is to/from text files, but some of it is from Win32 objects,
like MFC controls (edit boxes, etc).
I want to choose a standard and convert all of our existing code. The
choices I'm considering are:
1) std::string, with Boost::format and Boost::tokenizer
2) std::string, with StringStream
3) MFC's CString (I don't know the sscanf() equivalent here)
4) The new sprintf_s() and sscanf_s() "secure" functions available in
Visual Studio
5) Writing a custom string class, along with formatting functions
6) Writing custom formatting functions that work with std::string
I'm sure there's no one-size-fits-all answer to this problem, so I'm
looking for general feedback. On the other hand, this is such a
fundamental problem in application development that I'm a little surprised
there's no universally accepted solution. Or maybe there is and I just
didn't get the memo.
Thanks for suggestions and opinions.
Pat