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 と区別するためでしょうか?
これは移植可能な動作ですか?マニュアルページにこれが記載されていないのはなぜですか? 移植可能でない場合、どのプラットフォームがこの動作に準拠していますか?