stddef.mh

来自「开放源码的编译器open watcom 1.6.0版的源代码」· MH 代码 · 共 100 行

MH
100
字号
/***************************************************************************
 * FILE: stddef.h/cstddef (Standard definitions)
 *
:include crwat.sp
 *
 * Description: This header is part of the C/C++ standard library. It
 *              introduces certain commonly needed type names and
 *              supplies the offsetof macro.
 ***************************************************************************/
:segment CNAME
#ifndef _CSTDDEF_INCLUDED
#define _CSTDDEF_INCLUDED

#ifndef __cplusplus
#error the header cstddef requires C++
#endif
:elsesegment
#ifndef _STDDEF_H_INCLUDED
#define _STDDEF_H_INCLUDED
:endsegment

:include readonly.sp
:segment !CNAME
#ifdef __cplusplus
#include <cstddef>

// C99 types in stddef.h
#ifndef _SIZE_T_DEFINED
#define _SIZE_T_DEFINED
#define _SIZE_T_DEFINED_
using std::size_t;
#endif
#ifndef _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFIEND_
using std::ptrdiff_t;
#endif

#else /* __cplusplus not defined */
:endsegment

:segment CNAME
:include cpluspro.sp
:endsegment

#ifndef _COMDEF_H_INCLUDED
 #include <_comdef.h>
#endif

:include sizet.sp

:include wchar_t.sp

:include null.sp

:include ptrdiff.sp

:segment !CNAME
:include saferpro.sp

:include rsizet.sp

:include saferepi.sp
:endsegment

#ifdef __cplusplus
#define offsetof(__typ,__id) __offsetof(__typ,__id)
#else
#define offsetof(__typ,__id) ((size_t)&(((__typ*)0)->__id))
#endif
:segment QNX | LINUX
#if defined(__386__)
 _WCRTLINK extern int *__threadid(void); /* pointer to thread id */
 #define _threadid (__threadid())
#endif
:elsesegment DOS
:include ext.sp
#if defined(__386__) || defined(__AXP__) || defined(__PPC__) || defined(__MIPS__)
 _WCRTLINK extern int *__threadid(void); /* pointer to thread id */
 #define _threadid (__threadid())
 #if defined(__NT__)
  _WCRTLINK extern unsigned long __threadhandle( void );
 #endif
#else
 _WCRTDATA extern int _WCFAR *_threadid;        /* pointer to thread id */
#endif
#endif
:endsegment

:segment CNAME
:include cplusepi.sp
:endsegment

:: This #endif closes the #ifdef __cplusplus in stddef.h
:segment !CNAME
#endif
:endsegment

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?