
Given that there is a current move to rationalize the bind placeholders, and potentially introduce deprecated definitions, would it worth introducing a boost deprecated marker that makes use of compiler support to notify the user that they are using such definitions? I recently recompiled a project with BOOST_FILESYSTEM_NO_DEPRECATED (for no particular reason, except perhaps for tr1 readiness) and I was surprised how many uses of the old native_file_string and boost::native tags were buried in the code-base. Personally, I think it would be useful to be notified (or nagged :-)) if I was using deprecated functionality; I don't examine every comment of every function, and after successful compilation/unit-test they are easily forgotten. I don't know the best, generic, way of achieving this, but a simple approach that should work with MSVC and gcc would be to have: #ifndef BOOST_NO_DEPRECATED_WARNINGS // Don't nag me, compiler # if [BUILDING_WITH_MSVC] # define BOOST_DEPRECATED __declspec(deprecated) # else if [BUILDING_WITH_GCC] # define BOOST_DEPRECATED __attribute__ ((deprecated)) # else if [BUILDING_WITH_acme] # define BOOST_DEPRECATED ... # end if #endif #ifndef BOOST_DEPRECATED // No compiler support, just a tag # define BOOST_DEPRECATED #end if Then usage is: BOOST_DEPRECATED void TheFunction(...); The intent here is clear, and uncluttered, but may not be flexible enough. For example, a compiler may use syntax that declares its deprecated tag after the definition (which gcc supports, and it is usually shown that way in the guidelines). In which case, I expect the whole definition would have to be wrapped up in the macro. Also, there may be a case for separating the deprecated tags for functions, variables, types, etc.. As an (untested) illustration: #ifndef BOOST_NO_DEPRECATED_WARNINGS # if [BUILDING_WITH_MSVC] # define BOOST_DEPRECATED_FUNCTION(_F_) __declspec(deprecated) _F_ # else if [BUILDING_WITH_GCC] # define BOOST_DEPRECATED_FUNCTION(_F_) _F_ __attribute__ ((deprecated)) # else if [BUILDING_WITH_acme] # define BOOST_DEPRECATED_FUNCTION(_F_) ... # define BOOST_DEPRECATED_VARIABLE(_V_) ... # define BOOST_DEPRECATED_TYPE(_T_) ... # end if #endif #ifndef BOOST_DEPRECATED_FUNCTION # define BOOST_DEPRECATED_FUNCTION(_F_) _F_ #end if #ifndef BOOST_DEPRECATED_VARIABLE // Some compilers may use different syntax for variables, if not, // use same as deprecated function tag # define BOOST_DEPRECATED_VARIABLE(_V_) BOOST_DEPRECATED_FUNCTION(_V_) #endif #ifndef BOOST_DEPRECATED_TYPE // As for variables.. # define BOOST_DEPRECATED_TYPE(_T_) BOOST_DEPRECATED_FUNCTION(_T_) #endif Usage example: class path { ... BOOST_DEPRECATED_FUNCTION(string_type native_file_string() const) { return file_string(); } ... }; This is noisier, and may be worse if parentheses/comma expansion work-arounds are required, but it's an example. Personally, I prefer the simple BOOST_DEPRECATED, but I don't have experience with other compilers to know if that would suffice. Even if no support is available, having a benign tag in the definition provides information at the least. Regards...

On Tue, Jun 16, 2009 at 2:32 PM, Chard<boost@hazlewoods.eu> wrote:
Given that there is a current move to rationalize the bind placeholders, and potentially introduce deprecated definitions, would it worth introducing a boost deprecated marker that makes use of compiler support to notify the user that they are using such definitions?
I've used something like this and found it very useful. The usage was something like: BOOST_DEPRECATED("** use bar instead **") void foo(...); The string was useful for compilers that can print it along with the deprecation warning. Stjepan

"Stjepan Rajko" <stjepan.rajko@gmail.com> wrote in message news:64b40dc30906161632n274161e9v4a8dc648c2ef8c3b@mail.gmail.com...
On Tue, Jun 16, 2009 at 2:32 PM, Chard<boost@hazlewoods.eu> wrote:
Given that there is a current move to rationalize the bind placeholders, and potentially introduce deprecated definitions, would it worth introducing a boost deprecated marker that makes use of compiler support to notify the user that they are using such definitions?
I've used something like this and found it very useful. The usage was something like:
BOOST_DEPRECATED("** use bar instead **") void foo(...);
The string was useful for compilers that can print it along with the deprecation warning.
That seems sensible; even for compilers with no message the information is nicely contained. Personally, this feels like a no-brainer: it can sit in a stand-alone header, is only included by those headers that want to declare deprecated functionality, has no drastic effect on anything that currently exists, adds useful information and could be switched off anyway. Following a quick invesigation, it looks like CodeWarrior supports __declspec(deprecated). Does anybody else have an opinion, or is it just Stjepan, me and the tumbleweeds here?
participants (2)
-
Chard
-
Stjepan Rajko