Thread: pid_t type

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    12

    pid_t type

    Hi,
    In socket programming, why do we have a variable type pid_t to represent process id ?? I found its size being the same that of integer...I am confused..cannot we use int instead to denote process id ??

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    A lot of things all have the same size as int, but that's no reason to make them all ints.

    Besides, there's no reason to suppose that everyone else has a pid_t the same size as an int.

    So using a pid_t for things which expect a pid_t ensures your code will remain portable.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    12
    i got confused and asked this question as in

    http://www.symbian.com/developer/tec..._tTypedef.html

    i found pid_t to be defined the same type as that like int....that is why i got confused,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM