size_t
size_t corresponds to the integral data type returned by the language operator sizeof and is defined in the header file (among others) as an unsigned integral type.
size_t = unsigned int
size_t 类型定义在cstddef头文件中,该文件是C标准库的头文件的C++版。它是一个与机器相关的unsigned类型,其大小足以保证存储内存中对象的大小。
size_t是标准C库中定义的,应为unsigned int,在64位系统中为 long unsigned int。
NULL
This macro expands to a null pointer constant.
A null pointer is generally used to signify that a pointer does not point to any object.
In C++, NULL expands either to 0 or 0L.
在c中null经常被定义为(void)*0,即为空指针,而在C++中null为一整型0。
ptrdiff_t
This is the type returned by the subtraction operation between two pointers.
两个指针相减之差。
offsetof
offsetof (type,member)
This macro with functional form returns the offset value in bytes of member member in the structure type type.
此函数形式的宏返回member在结构type中的偏移。
-
"FONT-SIZE: 16px">
-
#include
-
#include
-
-
struct mystruct {
-
char singlechar;
-
char arraymember[10];
-
char anotherchar;
-
};
-
-
int main ()
-
{
-
printf ("offsetof(mystruct,singlechar) is %d\n",offsetof(mystruct,singlechar));
-
printf ("offsetof(mystruct,arraymember) is %d\n",offsetof(mystruct,arraymember));
-
printf ("offsetof(mystruct,anotherchar) is %d\n",offsetof(mystruct,anotherchar));
-
-
return 0;
-
}
-
/* offsetof example */
#include
#include
struct mystruct {
char singlechar;
char arraymember[10];
char anotherchar;
};
int main ()
{
printf ("offsetof(mystruct,singlechar) is %d\n",offsetof(mystruct,singlechar));
printf ("offsetof(mystruct,arraymember) is %d\n",offsetof(mystruct,arraymember));
printf ("offsetof(mystruct,anotherchar) is %d\n",offsetof(mystruct,anotherchar));
return 0;
}
阅读(5078) | 评论(0) | 转发(0) |