我在 Centos4 上发现 popen() 的手册页部分说明:
DESCRIPTION
The pclose() function shall close a stream that was opened by popen(), wait for the command to termi-
nate, and return the termination status of the process that was running the command language inter-
preter. However, if a call caused the termination status to be unavailable to pclose(), then pclose()
shall return -1 with errno set to [ECHILD] to report this situation.
但是,在我的 C++ 应用程序中,当我实际执行代码时,我看到终止状态向左移动了 8 位。也许这是为了将管道的终止状态中的 -1 与 pclose() 自己的退出状态 -1 区分开来?
这是便携式行为吗?为什么手册页没有提到这一点?如果不可移植,哪些平台符合这种行为?