简体   繁体   中英

C++ - include unistd.h: why not cunistd?

It's said that when including C header files in C++, the ".h" suffix should be removed and then add "c" at the beginning. For example, #include <cstdio> instead of #include <stdio.h> . But when I use sleep() in my code, #include <cunistd> does not work, but #include <unistd.h> works. Why not <cunistd> ?

您的算法对于大多数(所有?)标准C头是正确的,但unistd.h不是标准C的一部分,因此标准C ++反过来不包括它与其他c...头。

Because unistd.h never was part of the C language. It is part of the Operating System.

<unistd.h> ,代表unix标准标题,名称说明了一切。

unistd.h不是标准C的一部分。标准C ++ lib不包含其他c标头。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM