Skip to main

AK#Notes

Enable custom printf like function formatting check

.c
#if defined(COMPILER_CLANG) || defined(COMPILER_GCC)
#   define FmtTypeCheck(fmt_idx, arg_idx) __attribute__((format(printf, fmt_idx, arg_idx)))
#   define PRINTF_FORMAT_CHECK
#elif defined(COMPILER_MSVC)
#   define FmtTypeCheck(fmt_idx, arg_idx)
#   include <sal.h>
#   if _MSC_VER > 1400
#       define PRINTF_FORMAT_CHECK _Printf_format_string_
#   endif
#else
#   error printf type-safety check is not defined for this compiler.
#endif