The role of the typeof keyword.
Http://blog.chinaunix.net/uid-28458801-id-4200573.html
I. typeof:
Preface:
The typeof keyword is a new extension in C language, which is widely used in Linux kernel. (In fact, this is similar to the auto keyword of C ++ and the decltype keyword that can be inferred)
Ii. Example:
1. Define y as the data type pointed to by x:
Typeof (* x) y;
2. Define y to point x to an array of data types:
Typeof (* x) y [4];
3. Define y as a character pointer array:
Typeof (char *) [4] y;
This is equivalent to the following definition:
Char * y [4];
4, typeof (int *) p1, p2;/* Declares two int pointers p1, p2 */
Int * p1, * p2;
5, typeof (int) * p3, p4;/* Declares int pointer p3 and int p4 */
Int * p3, p4;
6, typeof (int [10]) a1, a2;/* Declares two arrays of integers */
Int a1 [10], a2 [10];
3.
, Limitations
Type name in typeof ConstructionNoContains Storage Class specifiers, suchExternOrStatic. However, type delimiters are allowed, suchConstOrVolatile. For example, the following code is invalid because it declares extern In the typeof construction:
Typeof (extern int);
Iv. File Reference
1, http://blog.csdn.net/wslong/article/details/7728811
Http://gcc.gnu.org/onlinedocs/gcc/Typeof.html#Typeof 2