Re: pid_t data type
- From: "jason.cipriani@xxxxxxxxx" <jason.cipriani@xxxxxxxxx>
- Date: Tue, 18 Mar 2008 12:09:30 -0700 (PDT)
On Mar 18, 3:02 pm, Rainer Weikusat <rweiku...@xxxxxxxxxxx> wrote:
"jason.cipri...@xxxxxxxxx" <jason.cipri...@xxxxxxxxx> writes:
On Mar 18, 5:48 am, Rainer Weikusat <rweiku...@xxxxxxxxxxx> wrote:
[snip]
Does it say somewhere that pid_t will never be a pointer type, or some
other type, like a float (which, while strange, is fine since it's
hidden behind the typedef)?
It does:
<URL:http://www.opengroup.org/onlinepubs/000095399/basedefs/sys/types.h.ht...>
I see. It also says:
"The implementation shall support one or more programming environments
in which the widths of blksize_t, pid_t, size_t, ssize_t, suseconds_t,
and useconds_t are no greater than the width of type long."
If you take that to mean that *all* supported "programming
environments" have pid_t with width no greater than the width of type
long, then it *is* save to store pid_t's in a long. Is there something
that indicates that it's not?
If that's the case the only two issues with using long instead of
pid_t are:
1) If that standard changes some day, and
2) Using pid_t clearly indicates that the variable, function
parameter, etc., is meant to hold a process ID, and not some arbitrary
integer with another meaning. Saves on documentation.
It seems pretty simple, what is the argument about? If you are
prepared to face the consequences of 1 and 2 then you'd use longs, and
if you don't want to think about it then you'd use pid_t's. I think #2
is a big reason to use pid_t's. I also can't think of a compelling
reason to do it otherwise. If you are trying to store pid_t's as data
in a file, it may be more painless to just store them as text strings
(like the string "58123")... ?
Jason
.
- Follow-Ups:
- Re: pid_t data type
- From: Rainer Weikusat
- Re: pid_t data type
- From: David Schwartz
- Re: pid_t data type
- References:
- pid_t data type
- From: Sanchit
- Re: pid_t data type
- From: Logan Shaw
- Re: pid_t data type
- From: Rainer Weikusat
- Re: pid_t data type
- From: Sanchit
- Re: pid_t data type
- From: Gordon Burditt
- Re: pid_t data type
- From: Rainer Weikusat
- Re: pid_t data type
- From: jason.cipriani@xxxxxxxxx
- Re: pid_t data type
- From: Rainer Weikusat
- pid_t data type
- Prev by Date: Re: NNTP client problem (BSD Sockets)
- Next by Date: Re: Bug help in AIX VisualAge C
- Previous by thread: Re: pid_t data type
- Next by thread: Re: pid_t data type
- Index(es):
Relevant Pages
|