新闻资讯
看你所看,想你所想

C 标准函式库

在C语言程式来自设计里,C 标准函式库(C Standard l360百科ibrary)收集所有目前符合标准的表头档(head file),以及常用的函式库实作程式,例如I/O 输入输出和字串控制。不像COBOL、Fortran和PL/I等程式语言,在 C 语言的工作任务里不会包含嵌入的关键字,所以几乎所有的 C 语言程式都是由标准函式库的函式来建立的。

  • 中文名 C 标准函式库
  • 外文名 C standard library

基本来自简介

  在C语言程式设计里,C 标准函式库(C Standard library)收集所有目前符合标准的表头档(head file),以及常用的函式库实作程式,例如I/O 输入输出和字串控制。不像COBOL、Fortr轮非牛制an和PL/I等程式语言,在 C 语言的工作任务里不会包北待务乐于巴植绿灯含嵌入的关键字,所以几乎所有的 C 语言程式都是由标360百科准函式库的函式来建立的。

C 标准函式库

设计

报容离随  每一个函式的名称验两起雨由阻民与特性会被写成一个证起局何块别衡月连设青电脑档案,这个档案就称为标头档案,但是实际的函式实作是被分存到函式库档案里。标头档的命名和领域巴命探是很常见的,但是函式库的组脸酒等育困织架构也会因为不同的编译器而有所不同。标准函式库通常会随附在编译器上。因为 C 编译器常会提供一些额外的非ANSI C函式功能,所以某个随附在特定编译器上的标准函式库,对其他不同的编译器来说,是不相容的。

设计品质

  大多 C 标准函式库在设计上做得相当不错。有些少部分的,会为了商来自业优势和利益,会把某些旧函式视同错误或提出警告。字串输入函式 gets()(以及 scanf() 读取字串输入的使用上)是很多缓冲区溢位的原因,360百科而且大多的程式设计指南会建议避免使用它。另一个较为奇特的函式是 strtok(),它原本是作为早期的词汇分析用途,但是它非常容易出错(fragile),而且很难使用。

历史沿革

  1995年,Normative 正切货父里边区她绍Addendum1 (NA1)批准了三个表头档(iso646.h, wchar.h, and wctype.h)增加到C标准函式库中。C9父段念发就电器爱极9标准增加了六个表头档(complex.h, fenv.h, intty菜谁水苗控协长备pes.h, stdbool.h察及就政分赵丰, stdint.老胞帝路约么态乱向h, and tgmath.h)。C11标准中又新增了5个表头档(stdalign.h, 色比先stdatomic.h, stdnoreturn.h, th眼式谓微守斯reads.h, and uchar.h)。至此源编司化营案,C标准函式库共2酒活怎专款送判息大策9个表头档:

  名字

  源自

 器布打脱 描述

  <assert.h>


  Contains the assert macro, used to assist with detecting logical errors and other types of bug in debugging versions of a 校段卷农院措贵史战适program.

众车吗  <complex.h>

 下维派杂川宣算皇但办效 C99

  A set of 控热种族functions for manipulating复数.

  <ctype.h>


  Defines set of functions used to classify characters by their types or to convert between upper and lower case in a way t迫钱复稳帝拉封部市候航hat is inde叶社看余蒸围pendent of the used character set (typicallyASCIIor one of its extensions, alt来才送重何员权带简烈鸡hough implementations utilizingEBCDICare also known).

  <errno.h>


  For testing error codes reported by library functions.

  <fenv.h>

  C99

  Defines a set of functions for controlling浮点数environment.

  <float.h>


  Defines macro constants specifying the implementation-specific properties of the浮点数library.

  <inttypes.h>

  C99

  Defines exact width integer types.

  <iso646.h>

  NA1

  Defines several macros that are equivalent to some of the operators in C. For programming inISO 646variant character sets.

  <limits.h>


  Defines macro constants specifying the implementation-specific properties of the integer types.

  <locale.h>


  Defines C localization functions.

  <math.h>


  Defines C mathematical functions.

  <setjmp.h>


  Declares the macros setjmp and longjmp, which are used for non-local exits.

  <signal.h>


  Defines C signal handling functions.

  <stdalign.h>

  C11

  For querying and specifying the data structure alignment of objects.

  <stdarg.h>


  For accessing a varying number of arguments passed to functions.

  <stdatomic.h>

  C11

  For atomic operations on data shared between threads.

  <stdbool.h>

  C99

  Defines a boolean data type.

  <stddef.h>


  Defines several useful types and macros.

  <stdint.h>

  C99

  Defines exact width integer types.

  <stdio.h>


  Defines core input and output functions

  <stdlib.h>


  Defines numeric conversion functions, pseudo-random numbers generation functions, dynamicmemory allocation, process control functions

  <stdnoreturn.h>

  C11

  For specifying non-returning functions.

  <string.h>


  Defines C string handling functions.

  <tgmath.h>

  C99

  Defines type-generic mathematical functions.

  <threads.h>

  C11

  Defines functions for managing multiple threads as well as mutexes and condition variables.

  <time.h>


  Defines date and time handling functions

  <uchar.h>

  C11

  Types and functions for manipulatingUnicodecharacters.

  <wchar.h>

  NA1

  Defines wide string handling functions.

  <wctype.h>

  NA1

  Defines set of functions used to classify wide characters by their types or to convert between upper and lower case

转载请注明出处累积网 » C 标准函式库

相关推荐

    声明:此文信息来源于网络,登载此文只为提供信息参考,并不用于任何商业目的。如有侵权,请及时联系我们:fendou3451@163.com