Warns of possible problems with string input and output format specifications. Functions diagnosed are printf, scanf, strftime, strfmon family functions and functions marked with format attributes.


Read syntax diagramSkip visual syntax diagram   .- -qnoformat---------------------------------.
   +- -qformat--=--noall-------------------------+
   |            .-=--all-----------------------. |
>>-+- -qformat--+------------------------------+-+-------------><
                |      .-:-----------------.   |
                |      V                   |   |
                         '-no-'  +-exarg-+

where suboptions are:

all Turns on all format diagnostic messages.
exarg Warns if excess arguments appear in printf and scanf style function calls.
nlt Warns if a format string is not a string literal, unless the format function takes its format arguments as a va_list.
sec Warns of possible security problems in use of format functions.
y2k Warns of strftime formats that produce a 2-digit year.
zln Warns of zero-length formats.
Specifying no in front of any of the above suboptions disables that group of diagnostic messages. For example, to turn off diagnostic messages for y2k warnings, specify -qformat=noy2k on the command line.


If -qformat is not specified on the command line, the compiler assumes a default setting of -qnoformat, which is equivalent to -qformat=noall.

If -qformat is specified on the command line without any suboptions, the compiler assumes a default setting of -qformat=all.


  1. To enable all format string diagnostics, enter either of the following:

    xlc++ myprogram.C -qformat=all
    xlc++ myprogram.C -qformat
  2. To enable all format diagnostic checking except that for y2k date diagnostics, enter:
    xlc++ myprogram.C -qformat=all:noy2k

Related information