function::user_ulong_warn - Linux


function::user_ulong_warn is a constructor that builds a warning handler function that converts an unsigned 64-bit integer to a warning


namespace function {

bool user_ulong_warn(warning warner, int line, string const& spec, unsigned long long val);


The following parameters are accepted:

  • warner: A suitable predicate function that is ‘true’ when a warning should be issued
  • line: Line number of the code where the function is called.
  • spec: Format specification string for the val argument (see printf(3)).
  • val: Variable to be dumped in accordance with the format specification spec




The following code sample shows you how to use the function::user_ulong_warn function:

void f() {
  auto const& warner = function::user_julong_warn;
  warner(false, __LINE__, "%lld", 42ull);  // no warning
  warner(true, __LINE__, "%lld", 42ull);   // warning: 42

Common Issues



This function can be used in conjunction with the function::user_julong_info and function::user_julong_err functions to cover most logging needs.

Related Commands