From: Tom Browder <tom.browder@gm...> - 2013-06-29 11:55:15
I'm glad to see more code using C++, and I am lobbying for the
addition of the SafeFormat functions from the Loki Library. The
library was started by Andrei Alexandrescu, and its home page is here:
It is under the MIT License.
The SafeFormat functions are: FPrintf, Printf, and SPrintf, mimicking
C's fprintf, printf, and sprintf, but with better type safety.
Another advantage is that, for FPrintf, the output can be to either C
file pointers or C++ ostreams, which helps immensely when porting old
C code to streams incrementally.
Only three files are needed from the library set and they are:
Of course there are other handy things in the library as well, so
enjoy perusing them.
From: Christopher Sean Morrison <brlcad@ma...> - 2013-06-30 03:52:13
On Jun 29, 2013, at 7:54 AM, Tom Browder wrote:
> The SafeFormat functions are: FPrintf, Printf, and SPrintf, mimicking
> C's fprintf, printf, and sprintf, but with better type safety.
> Another advantage is that, for FPrintf, the output can be to either C
> file pointers or C++ ostreams, which helps immensely when porting old
> C code to streams incrementally.
Since this falls squarely in LIBBU's domain, what would be the value? There doesn't seem to be any integration issues, but I'm having trouble seeing how they'd be put to use...
We cannot expose C++ constructs in the LIBBU API (as it is a C API), so the SafeFormat functions would end up being implementation detail behind some wrapper like bu_log() or bu_vls_vprintf()... which already work very well. I have looked at Loki for some other things, but I actually believe there are several constructs that we do much better in our core libraries. Some not as well, but features we don't use.
Get latest updates about Open Source Projects, Conferences and News.