stddef: Let offset be defined from toolchain

Let `offset` could be defined from toolchain,
Which will be usefull for fixed code project.
This commit is contained in:
zhuyanlin
2021-08-27 10:41:53 +08:00
committed by Xiang Xiao
parent 9a2e9de4bc
commit 46a93b5045
2 changed files with 24 additions and 22 deletions
-22
View File
@@ -31,28 +31,6 @@
* Pre-processor Definitions
****************************************************************************/
/* The <stddef.h> header shall define the following macros:
*
* NULL
* The null pointer constant.
*
* NOTE: Currently the definition of NULL is in sys/types.h but should
* be moved here sometime.
*
* offsetof(type, member-designator)
* Integer constant expression of type size_t, the value of which is the
* offset in bytes to the structure member (member-designator), from the
* beginning of its structure (type).
*
* NOTE: This version of offsetof() depends on behaviors that could be
* undefined for some compilers. It would be better to use a builtin
* function if one exists.
*
* Reference: Opengroup.org
*/
#define offsetof(a, b) ((size_t)(&(((a *)(0))->b)))
/****************************************************************************
* Type Definitions
****************************************************************************/