Skip to main content

IAR Embedded Workbench for Arm 9.70.x

__scanf_args

In this section:
Syntax
#pragma __scanf_args
Description

Use this pragma directive on a function with a scanf-style format string. For any call to that function, the compiler verifies that the argument to each conversion specifier, for example %d, is syntactically correct.

You cannot use this pragma directive on functions that are members of an overload set with more than one member.

Example
#pragma __scanf_args
int scanf(char const *,...);

int GetNumber()
{
  int nr;
  scanf("%d", &nr);  /* Compiler checks that
                        the argument is a
                        pointer to an integer */

  return nr;
}