
From: Eljay Love-Jensen <eljay@adobe.com>
Take the Standard C Library.
Yes! Take it, please! ;-)
Create a new namespace, "boost::xtd::" for instance. For every function in the Standard C Library, create an analog in the "boost::xtd::" namespace. The analog function would have the same functional behavior as the StdCLib function, with the notable difference that any errors will generate an exception. [snip] Opinions of this idea merits being implemented?
The first question to ask is whether an exception is the right way to handle an error for each case. Often it isn't. The next question to ask is whether there is already a better alternative available in C++. For example, instead of strtok() et al, you should use Boost.Tokenizer. Finally, if there isn't a better alternative, and the functionality is needed, you must ask whether there aren't aspects of the C function that couldn't be made better in C++. In that case, you'd create the new function or class to work in a C++ way. Thus, I don't see much merit in wrapping all of the C Library functions so they throw exceptions. -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;