Boost logo

Boost :

Subject: Re: [boost] Review - boost::log
From: Artyom (artyomtnk_at_[hidden])
Date: 2010-03-14 17:27:20


> > Most of my recent projects have consisted of ripping out > templated > code and replacing it with "C" friendly "API's". > > I still prefer C++ for most tasks.  However, I like to > wrap them in "C" > api's so others can use them.  Using stream operators > or std::string in a public API is a absolutly horrible > thing to do around > here. Few points: Indeed "C" API is much nicer in terms of shortness and usability but: 1. It is limited to basic types only. In comparison: debug_log("player position (%f,%f,%f)",pos.x,pos.y,pos.z) or debug_log() << format("player position %1%") % pos. This makes the difference. Yes, templates are heavy, bloated hard to compile and to be honest... I quite hate to use heavily "templated" libraries (see ASIO awesome piece of software that drives me crazy when it comes to compilation times). But... Once C++0x comes things would be simpler and faster at least in printf like cases. For a long time period I preferred C style printfs, but now I use boost::format like API anywhere even it costs me a lot in terms of compilation times. Why? Flexibility that "C" API does not have. Same for Boost.Locale I created iostreams based `boost::locale::format` because it is much more powerful. So... 1. Yes iostreams heavy bloated and requires endless compilation times. 2. But iostreams are so much flexible that it worth it. Take a look on what can be done with iostreams in Boost.Locale... Quite amazing things. Artyom


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk