Re: pid_t data type



Logan Shaw <lshaw-usenet@xxxxxxxxxxxxx> writes:
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.

A 'typedef-name' is just an alias for an existing type. This means
that if an implementation had a

typedef long pid_t

the only difference between the two would be that usage looked
different in source code. One of the nice properties of C is that
'types' stick to objects and not to values: A value originally
returned be fork can be stored into anything large enough to represent
it without being "damaged" and a compiler is required to not introduce
artificial differences between identically valued numbers coming from
different origins.

.



Relevant Pages

  • Re: pid_t data type
    ... management.. ... using what the producers of the system have tested. ... it without being "damaged" and a compiler is required to not introduce ... artificial differences between identically valued numbers coming from ...
    (comp.unix.programmer)
  • Re: pid_t data type
    ... management.. ... using what the producers of the system have tested. ... it without being "damaged" and a compiler is required to not introduce ... artificial differences between identically valued numbers coming from ...
    (comp.unix.programmer)
  • Re: pid_t data type
    ... Rainer Weikusat wrote: ... management.. ... using what the producers of the system have tested. ... artificial differences between identically valued numbers coming from ...
    (comp.unix.programmer)