[hellogcc] Re: [hellogcc] gccint中GTY一个示例,觉得前后矛盾

  • From: Yousong Zhou <yszhou4tech@xxxxxxxxx>
  • To: perr <2029352818@xxxxxx>
  • Date: Fri, 29 Aug 2014 17:05:28 +0800

>
> struct rtvec_def * p_t = rtvec_alloc‍(5);
> int n = sizeof(*p_t);
> 此时GTY会起作用对吗?
> ‍

我没有玩过GCC的源码。

虽然GCC自己的C代码看起来添加了一些额外的特性(比如这里的GC?),但是,从设计上来说,应该都属于扩展,而不太可能是override已有C标准中的元素。所以,应该是,sizeof(*p_t)
== sizeof(struct rtvec_def)

另外,再搜源码 [1]

[1] {GET,PUT}_NUM_ELEM,
https://github.com/gcc-mirror/gcc/blob/master/gcc/rtl.h#L661


                yousong

Other related posts: