Re: pid_t data type



Sanchit wrote:
So if i will use long.. and i am not concerned with memory
management.. will it be fine in every case..

If you use pid_t, it will be fine in every case. If you use
long, there are no guarantees. If you use pid_t, you will be
using what the producers of the system have tested. If you
use long, you will be using something that is unsupported and
untested.

are there any specific
case where we should use only pid_t and not long (any any int type)

Yes, any case when you want to store a pid, you should use pid_t.
You might not experience problems with a long instead, but since
you don't know, and since it is just easy to use pid_t and pid_t
provides better documentation and better readability, why would
do it the other way and introduce potential problems for no
benefit?

- Logan
.