Tyler Durden
Tyler Durden

Reputation: 11532

Why do some C/C++ headers have "sys/" in front of them?

Some C/C++ headers like <sys/ioctl.h> have a sys/ prefix in front of them.

(There are also some with a net/ prefix.)

Why is this?

Upvotes: 7

Views: 3107

Answers (1)

OriBS
OriBS

Reputation: 732

Practically, this shows those file are under a sub-folder named "sys" in one of the standard list of system directories (e.g compiler default search path, or folder given as a parameter during the build).

The reason they are in a sub-folder is to indicate they are not a part of the c or c++ standard libraries, but rather a specific extension, usually provided by the operating system you are working in.

Note that this is only a matter of conventions, and not part of the specified behavior by C or C++. Usually to really understand those kind of header you will look at further documentation provided by the operating system you are working under.

Upvotes: 10

Related Questions