| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 463 人关注过本帖
标题:<stddef>头文件的问题
只看楼主 加入收藏
lyj23
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:168
专家分:140
注 册:2010-10-31
结帖率:86.21%
收藏
已结贴  问题点数:10 回复次数:5 
<stddef>头文件的问题
如题所示,高手请帮忙详细讲解一下!

如果高手认为问题弱智,喷者莫喷
搜索更多相关主题的帖子: 弱智 
2011-05-20 11:39
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:0 
是不是弱智,我不敢下结论。
但,“<stddef>头文件的问题”是什么问题,我真听不懂
2011-05-20 12:03
Toomj
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
帖 子:257
专家分:1826
注 册:2011-5-17
收藏
得分:5 

stddef.h(通常#include<stdio.h>就包含了他)

  C语言头文件。
  作用:定义/声明了一些经常使用的常数,类型和变量
  VC中stddef.h的内容:
  /***
  *stddef.h - definitions/declarations for common constants, types, variables
  *
  * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  *
  *Purpose:
  * This file contains definitions and declarations for some commonly
  * used constants, types, and variables.
  * [ANSI]
  *
  * [Public]
  *
  ****/
  #if _MSC_VER > 1000
  #pragma once
  #endif
  #ifndef _INC_STDDEF
  #define _INC_STDDEF
  #if !defined(_WIN32) && !defined(_MAC)
  #error ERROR: Only Mac or Win32 targets supported!
  #endif
  #ifdef __cplusplus
  extern "C" {
  #endif
  /* Define _CRTIMP */
  #ifndef _CRTIMP
  #ifdef _DLL
  #define _CRTIMP __declspec(dllimport)
  #else /* ndef _DLL */
  #define _CRTIMP
  #endif /* _DLL */
  #endif /* _CRTIMP */
  /* Define __cdecl for non-Microsoft compilers */
  #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  #define __cdecl
  #endif
  /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  #ifndef _CRTAPI1
  #if _MSC_VER >= 800 && _M_IX86 >= 300
  #define _CRTAPI1 __cdecl
  #else
  #define _CRTAPI1
  #endif
  #endif
  /* Define NULL pointer value and the offset() macro */
  #ifndef NULL
  #ifdef __cplusplus
  #define NULL 0
  #else
  #define NULL ((void *)0)
  #endif
  #endif
  #define offsetof(s,m) (size_t)&(((s *)0)->m)
  /* Declare reference to errno */
  #if (defined(_MT) || defined(_DLL)) && !defined(_MAC)
  _CRTIMP extern int * __cdecl _errno(void);
  #define errno (*_errno())
  #else /* ndef _MT && ndef _DLL */
  _CRTIMP extern int errno;
  #endif /* _MT || _DLL */
  /* define the implementation dependent size types */
  #ifndef _PTRDIFF_T_DEFINED
  typedef int ptrdiff_t;
  #define _PTRDIFF_T_DEFINED
  #endif
  #ifndef _SIZE_T_DEFINED
  typedef unsigned int size_t;
  #define _SIZE_T_DEFINED
  #endif
  #ifndef _WCHAR_T_DEFINED
  typedef unsigned short wchar_t;
  #define _WCHAR_T_DEFINED
  #endif
  #ifdef _MT
  _CRTIMP extern unsigned long __cdecl __threadid(void);
  #define _threadid (__threadid())
  _CRTIMP extern unsigned long __cdecl __threadhandle(void);
  #endif
  #ifdef __cplusplus
  }
  #endif
  #endif /* _INC_STDDEF */

2011-05-20 14:46
Toomj
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
帖 子:257
专家分:1826
注 册:2011-5-17
收藏
得分:0 
楼主啊,这类问题自己多百度百度哈
2011-05-20 14:48
pangding
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:北京
等 级:贵宾
威 望:94
帖 子:6784
专家分:16751
注 册:2008-12-20
收藏
得分:5 
给 MS 的头文件其实很不靠谱……
还是找点说明用的东西比较管用。
标准定义(<stddef.h>)

文件<stddef.h>里包含了标准库的一些常用定义,无论我们包含哪个标准头文件,<stddef.h>都会被自动包含进来。这个文件里定义:

l         类型size_t(sizeof运算符的结果类型,是某个无符号整型);

l         类型ptrdiff_t(两个指针相减运算的结果类型,是某个有符号整型);

l         类型wchar_t(宽字符类型,是一个整型,其中足以存放本系统所支持的所有本地环境中的字符集的所有编码值。这里还保证空字符的编码值为0);

l         符号常量NULL(空指针值);

l         宏offsetor(这是一个带参数的宏,第一个参数应是一个结构类型,第二个参数应是结构成员名。offsetor(s,m)求出成员m在结构类型t的变量里的偏移量)。
其中有些定义也出现在其他头文件里(如NULL)。

2011-05-20 15:30
lyj23
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:168
专家分:140
注 册:2010-10-31
收藏
得分:0 
谢谢大家,5楼的回答让我受益!

3楼的嘛,可惜我水平太差了,看不太懂!sorry
2011-05-21 16:05
快速回复:<stddef>头文件的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023556 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved