在linux中定义的是c ++ size_t [英] Where is c++ size_t defined in linux
问题描述
现在我说的是程序员使用typedef关键字的新类型定义。只要我的学生习惯了size_t类型(例如通过使用funciton length()),我不得不请他们一点努力只是相信它是一个整数类型,我认为它是伟大的
Now I'm talking about new type definition by a programmer using typedef keyword. As long as my pupils are used to the type size_t (for example by using funciton length ()), for which I had to ask them a little effort to just "believe" it is an integer type, I think it woud be great to show noew them where this type is defined.
所以,我在ubuntu框中的/ usr / include中做了很多grep,我看到的是size_t是,反过来,size_type的一个重新定义,反过来又是一个metadata_type的重新定义,这就是这个目录的结束。找不到最后的typedef unsigned int metadata_type;。
So, I've done a lot grep's in /usr/include in an ubuntu box, and what I see is that size_t is, in turn, a redefinition of size_type wich in turn is a redefinition of metadata_type, and that's the end in this directory. Not found the final "typedef unsigned int metadata_type;".
在/ usr / src中找到anohter以前的类型叫yy_size_t,...
In /usr/src I've found anohter previous type called yy_size_t,...
但是,在任何情况下,我一直无法到达链的末端。
But, in any case I've been unable the get to the end of the chain.
有人知道在哪里找到out的最终定义检查,它是一个unsigned int(或类似)?
可能是我错过了一个开发包在我的盒子里?在这种情况下,为什么我能够使用size_t类型编译程序?
Does anyone know where to find out the final definition to check out that it is an unsigned int (or the like)? May be I miss a development package in my box? In this case, why I'm able to compile programs using size_t type?
推荐答案
手动检查C预处理器( cpp
),并检查输出:
You can try to expand standard include files with the C preprocessor (cpp
) by hand and check the output of that:
$ echo '#include <stdlib.h>' | cpp -I/usr/include - > stdlib-expanded.c
你会发现 cpp
甚至包括标记,以指示
stdlib-expanded.c
中的代码已包括在哪些文件中。
You will find that the output of cpp
even includes markers to indicate from which files the code in stdlib-expanded.c
has been included.
这篇关于在linux中定义的是c ++ size_t的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!