| Extracted from Pike v7.8 release 866 at 2018-02-09.

[Top]

# Method __handle_sprintf_format()

Method __handle_sprintf_format

  `type(mixed) __handle_sprintf_format(string attr, string fmt, type(mixed) arg_type, type(mixed) cont_type)`

Description

  Type attribute handler for `"sprintf_format"`.

Parameter `attr`

  Attribute to handle, either `"sprintf_format"` or `"strict_sprintf_format"`.

Parameter `fmt`

  Sprintf-style formatting string to generate type information from.

Parameter `arg_type`

  Declared type of the fmt argument (typically `string`).

Parameter `cont_type`

  Continuation function type after the fmt argument. This is scanned for the type attribute `"sprintf_args"` to determine where the remaining arguments to sprintf() will come from.

  This function is typically called from PikeCompiler()->apply_attribute_constant() and is used to perform stricter compile-time argument checking of sprintf() -style functions.

  It currently implements two operating modes depending on the value of attr :

  `"strict_sprintf_format"` | The formatting string fmt is known to always be passed to sprintf() .
  `"sprintf_format"` | The formatting string fmt is passed to sprintf() only if there are `"sprintf_args"`.

See also

  PikeCompiler()->apply_attribute_constant() , sprintf()