current_function.adoc 1.0 KB

123456789101112131415161718192021222324252627282930
  1. ////
  2. Copyright 2002, 2017 Peter Dimov
  3. Distributed under the Boost Software License, Version 1.0.
  4. See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt
  6. ////
  7. # Current Function Macro, <boost/current_function.hpp>
  8. :toc:
  9. :toc-title:
  10. :idprefix:
  11. ## BOOST_CURRENT_FUNCTION
  12. The header `<boost/current_function.hpp>` defines a single macro, `BOOST_CURRENT_FUNCTION`,
  13. similar to the C99 predefined identifier `\\__func__`.
  14. `BOOST_CURRENT_FUNCTION` expands to a string literal containing
  15. the (fully qualified, if possible) name of the enclosing function. If there is
  16. no enclosing function, the behavior is unspecified.
  17. Some compilers do not provide a way to obtain the name of the current enclosing
  18. function. On such compilers, or when the macro `BOOST_DISABLE_CURRENT_FUNCTION`
  19. is defined, `BOOST_CURRENT_FUNCTION` expands to `"(unknown)"`.
  20. `BOOST_DISABLE_CURRENT_FUNCTION` addresses a use case in which the programmer
  21. wishes to eliminate the string literals produced by `BOOST_CURRENT_FUNCTION` from
  22. the final executable for security reasons.