Page 174 - C-Language
P. 174

If a length modifier appears with any conversion specifier other than as specified above, the
        behavior is undefined.


        Microsoft specifies some different length modifiers, and explicitly does not support hh, j, z, or t.


          Modifier   Modifies         Applies to


                     d, i, o, x, or
          I32                         __int32
                     X

          I32        o, u, x, or X    unsigned __int32


                     d, i, o, x, or
          I64                         __int64
                     X


          I64        o, u, x, or X    unsigned __int64

                     d, i, o, x, or   ptrdiff_t (that is, __int32 on 32-bit platforms, __int64 on 64-bit
          I
                     X                platforms)


                                      size_t (that is, unsigned __int32 on 32-bit platforms, unsigned
          I          o, u, x, or X
                                      __int64 on 64-bit platforms)

                     a, A, e, E, f,   long double (In Visual C++, although long double is a distinct type, it
          l or L
                     g, or G          has the same internal representation as double.)


                                      Wide character with printf and wprintf functions. (An lc, lC, wc or
          l or w     c or C           wC type specifier is synonymous with C in printf functions and with
                                      c in wprintf functions.)

                                      Wide-character string with printf and wprintf functions. (An ls, lS,
          l or w     s, S, or Z       ws or wS type specifier is synonymous with S in printf functions and
                                      with s in wprintf functions.)



        Note that the C, S, and Z conversion specifiers and the I, I32, I64, and w length modifiers are
        Microsoft extensions. Treating l as a modifier for long double rather than double is different from
        the standard, though you'll be hard-pressed to spot the difference unless long double has a
        different representation from double.


        Printing format flags


        The C standard (C11, and C99 too) defines the following flags for printf():


          Flag      Conversions      Meaning


                                     The result of the conversion shall be left-justified within the field.
          -         all
                                     The conversion is right-justified if this flag is not specified.

          +         signed           The result of a signed conversion shall always begin with a sign ( '+'


        https://riptutorial.com/                                                                             150
   169   170   171   172   173   174   175   176   177   178   179