3

When I type printf, Xcode give me an autocomplete-hint like printf(const char *restrict, ...).

I want to know what does "const char *restrict mean?
And where can I find more information about these parameters which Xcode throws for every function?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
josh_balmer
  • 43
  • 1
  • 1
  • 6

1 Answers1

1

There is no magic behind this: Xcode looks at the headers that you included, checks function prototypes, and figures out signatures, and provides you hints as you type based on the prefixes that it sees.

Look at the header documentation for the headers that you include to find out what functions they have, and what are the parameters. For example, printf is part of stdio.h header, which is documented here. The signature of printf is as follows:

int printf(const char *restrict, ...);

That is why Xcode suggests printf(const char *restrict, ...) for the hint as you type.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
  • 3
    `restrict` is not the name. – Deduplicator Dec 04 '14 at 02:40
  • @josh_balmer That's the type of the first parameter. Since `printf` takes a variable number of arguments (as indicated by `...` at the end) Xcode cannot tell you more about parameters the function takes. Other functions, on the other hand, such as `strcmp` or `strncpy`, you would get more hints about the function arguments. – Sergey Kalinichenko Dec 04 '14 at 03:11