Alexander Reshytko
Alexander Reshytko

Reputation: 2236

Where to find in what standard (ISO C, SUS, POSIX) and what version of it a particular C header or function is defined?

Sometimes I need to write a low level multiplatform C/C++ code so preprocessor environment macroses come in handy. But is there some method or a single internet resource or a place in man where I can easily find a standard where a particular Unix API was first introduced to use a particular macro definition in my code allowing the usage of that API?

Upvotes: 0

Views: 449

Answers (2)

Jens Gustedt
Jens Gustedt

Reputation: 78903

Man is your friend. My linux distribution has all POSIX definitions as man pages. E.g

man 3p printf

gives me the POSIX definition, whereas

man 3 printf

gives me the linux specific version.

To search for all POSIX stuff my strategy is to enter

opengroup name-of-function

in my prefered search engine.

For ISO C you find the standards easily online (well oficially these are drafts). The current C standard, C11, is n1570.pdf, you should find it through that.

Upvotes: 3

Kerrek SB
Kerrek SB

Reputation: 476970

You can try the man pages.

For example, man 3 printf says:

Conforming To

The fprintf(), printf(), sprintf(), vprintf(), vfprintf(), and vsprintf() functions conform to C89 and C99. The snprintf() and vsnprintf() functions conform to C99.

And man 2 open:

Conforming to

SVr4, 4.3BSD, POSIX.1-2001.

Upvotes: 1

Related Questions