GCC声明:typedef __pid_t pid_t? [英] GCC declarations: typedef __pid_t pid_t?

查看:120
本文介绍了GCC声明:typedef __pid_t pid_t?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对(例如)pid_t的声明感到困惑。 __pid_t是什么意思?它是在别处定义的另一种类型吗如果是,在哪里?为什么我的types.h在ubuntu 13.04 64bit中定义了pid_t就像这样:

  #ifndef __pid_t_defined 
typedef __pid_t pid_t;
#define __pid_t_defined
#endif

而不是像

  typedef int pid_t; 

我看到一些网站拥有types.h头文件,并且声明是最后一种方式。这是一个:
http://www.sde.cs.titech.ac.jp/~gondow /dwarf2-xml/HTML-rxref/app/gcc-3.3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/include/sys/types.h.html



更新:

好的,我发现pid_t是__pid_t,它是__PID_T_TYPE,它是__S32_TYPE这是一个int。我现在的问题是这是为什么? POSIX只声明pid_t必须是一个有符号的整数,所以为什么声明在头文件中输入太深?

解决方案

好的,我发现__pid_t表示这个问题的答案:

/ p>

QUOTE

  typedef __pid_t pid_t; 
...
#define __STD_TYPE typedef
__STD_TYPE __PID_T_TYPE __pid_t; / *进程标识的类型。 * /
...
#define __PID_T_TYPE __S32_TYPE
...
#define __S32_TYPE int

UNQUOTE



所以pid_t是__pid_t,它是一个__PID_T_TYPE,它是一个__S32_TYPE,它是一个int。


I am confused about the declaration of (for example) pid_t. What does __pid_t mean? Is it another type defined elsewhere? If yes, where? Why is my types.h in ubuntu 13.04 64bit defining pid_t like:

#ifndef __pid_t_defined
typedef __pid_t pid_t;
#define __pid_t_defined
#endif

and not something like

typedef int pid_t;

I saw some websites that have types.h headers with the declaration done the last way. This is one: http://www.sde.cs.titech.ac.jp/~gondow/dwarf2-xml/HTML-rxref/app/gcc-3.3.2/lib/gcc-lib/sparc-sun-solaris2.8/3.3.2/include/sys/types.h.html

UPDATE:

Ok I found out that a pid_t is an __pid_t which is an __PID_T_TYPE which is which is an __S32_TYPE which is an int. My question now is why is this? POSIX only states that pid_t has to be a signed integer, so why make the declaration enter soo deep in header files?

解决方案

Ok I found what the __pid_t means on the answer to this question: Why PID of a process is represented by opaque data type?

QUOTE

typedef __pid_t pid_t;
...
# define __STD_TYPE     typedef
__STD_TYPE __PID_T_TYPE __pid_t;    /* Type of process identifications.  */
...
#define __PID_T_TYPE        __S32_TYPE
...
#define __S32_TYPE      int

UNQUOTE

So pid_t is an __pid_t which is an __PID_T_TYPE which is which is an __S32_TYPE which is an int.

这篇关于GCC声明:typedef __pid_t pid_t?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆