C, C++ on GNU Linux - gcc编译器与 glibc和libstdc++

GCC

The GNU Compiler Collection includes front ends for  C C++ , Objective-C,  Fortran , Ada, and Go, as well as libraries for these languages ( libstdc++,... ). GCC was originally written as the compiler for the  GNU operating system .

C Standards Support in GCC

Status of C99 features in GCC
C99 is substantially completely supported as of GCC 4.5 (with  -std=c99 -pedantic-errors  used;  -fextended-identifiers  also needed to enable extended identifiers before GCC 5), modulo bugs and floating-point issues (mainly but not entirely relating to optional C99 features from Annexes F and G). The following table gives more details of the C99 support in different GCC versions.
This table is based on the list in the foreword to  N1256  (ISO/IEC 9899:1999 (E), consolidated with ISO/IEC 9899:1999/Cor.1:2001 (E), ISO/IEC 9899:1999/Cor.2:2004 (E) and ISO/IEC 9899:1999/Cor.3:2007 (E)).

'C++' Standards Support in GCC

GCC supports different dialects of C++, corresponding to the multiple published ISO standards. Which standard it implements can be selected using the  -std=  command-line option.
For information about the status of the library implementation, please see  this page .

C++11 Support in GCC

GCC 4.8.1 was the first feature-complete implementation of the 2011 C++ standard, previously known as C++0x.
This mode can be selected with the  -std=c++11  command-line flag, or  -std=gnu++11  to enable GNU extensions as well.
For information about C++11 support in a specific version of GCC, please see:
...

C++98 Support in GCC

GCC has full support for the 1998 C++ standard as modified by the 2003 technical corrigendum and some later defect reports, excluding the  export  feature which was later removed from the language.
This mode is the default in GCC versions prior to 6.1; it can be explicitly selected with the  -std=c++98  command-line flag, or  -std=gnu++98  to enable GNU extensions as well.




glibc

What is glibc?

The GNU C Library project provides   the  core libraries for the GNU system and GNU/Linux systems , as well as many other systems that use Linux as the kernel. These libraries provide critical APIs including ISO C11, POSIX.1-2008, BSD, OS-specific APIs and more . These APIs include such foundational facilities as  open read write malloc printf getaddrinfo dlopen , pthread_create crypt login exit  and more.
The GNU C Library is designed to be a backwards compatible, portable, and high performance ISO C library. It aims to follow all relevant standards including ISO C11, POSIX.1-2008, and IEEE 754-2008.
The project was started circa 1988 and is almost 30 years old. You can see the complete project  release history  on the wiki.
Despite the project's age there is still a lot to do so please  Get Started  and  Get Involved!

The GNU C Library manual


......

1 Introduction
The C language provides no built-in facilities for performing such common operations as input/output, memory management, string manipulation, and the like. Instead, these facilities are defined in a standard  library , which you compile and link with your programs.
The GNU C Library, described in this document, defines all of the library functions that are specified by the ISO C standard, as well as additional features specific to POSIX and other derivatives of the Unix operating system, and extensions specific to GNU systems.
The purpose of this manual is to tell you how to use the facilities of the GNU C Library. We have mentioned which features belong to which standards to help you identify things that are potentially non-portable to other systems. But the emphasis in this manual is not on strict portability.
•  Getting Started :
  
What this manual is for and how to use it.
  
Standards and sources upon which the GNU C library is based.
  
Some practical uses for the library.
  
Overview of the remaining chapters in this manual.

1.1 Getting Started
This manual is written with the assumption that you are at least somewhat familiar with the C programming language and basic programming concepts. Specifically, familiarity with ISO standard C (see ISO C ), rather than “traditional” pre-ISO C dialects, is assumed.
The GNU C Library includes several  header files , each of which provides definitions and declarations for a group of related facilities; this information is used by the C compiler when processing your program. For example, the header file  stdio.h  declares facilities for performing input and output, and the header file  string.h  declares string processing utilities. The organization of this manual generally follows the same division as the header files.
If you are reading this manual for the first time, you should read all of the introductory material and skim the remaining chapters. There are a  lot  of functions in the GNU C Library and it’s not realistic to expect that you will be able to remember exactly  how  to use each and every one of them. It’s more important to become generally familiar with the kinds of facilities that the library provides, so that when you are writing your programs you can recognize  when  to make use of library functions, and  where  in this manual you can find more specific information about them.


1.2.1 ISO C
The GNU C Library is compatible with the C standard adopted by the American National Standards Institute (ANSI):  American National Standard X3.159-1989—“ANSI C”  and later by the International Standardization Organization (ISO):  ISO/IEC 9899:1990, “Programming languages—C” . We here refer to the standard as ISO C since this is the more general standard in respect of ratification. The header files and library facilities that make up the GNU C Library are a superset of those specified by the ISO C standard.

1.2.2 POSIX (The Portable Operating System Interface)
The GNU C Library is also compatible with the ISO  POSIX  family of standards , known more formally as the  Portable Operating System Interface for Computer Environments  (ISO/IEC 9945). They were also published as ANSI/IEEE Std 1003. POSIX is derived mostly from various versions of the Unix operating system.
The library facilities specified by the POSIX standards are a superset of those required by ISO C; POSIX specifies additional features for ISO C functions, as well as specifying new additional functions. In general, the additional requirements and functionality defined by the POSIX standards are aimed at providing lower-level support for a particular kind of operating system environment, rather than general programming language support which can run in many diverse operating system environments.
The GNU C Library implements all of the functions specified in  ISO/IEC 9945-1:1996, the POSIX System Application Program Interface , commonly referred to as POSIX.1 . The primary extensions to the ISO Cfacilities specified by this standard include file system interface primitives (see  File System Interface ), device-specific terminal control functions (see  Low-Level Terminal Interface ), and process control functions (see  Processes ).
Some facilities from  ISO/IEC 9945-2:1993, the POSIX Shell and Utilities standard  (POSIX.2) are also implemented in the GNU C Library. These include utilities for dealing with regular expressions and other pattern matching facilities (see  Pattern Matching ).


libstdc++

The GNU C++ Library manual



附:libc++ 与 libstdc++

libc++/libstdc++,这两个库有关系吗?有。两个都是C++标准库。libc++是针对clang编译器特别重写的C++标准库,那libstdc++自然就是gcc的事儿了。libstdc++与gcc的关系就像clang与libc++. 其中的区别这里不作详细介绍了。

----------------------------------------------------

三者关系

libstdc++与gcc是捆绑在一起的,也就是说安装gcc的时候会把libstdc++装上。 那为什么glibc和gcc没有捆绑在一起呢?
相比glibc,libstdc++虽然提供了c++程序的标准库,但它并不与内核打交道。对于系统级别的事件,libstdc++首先是会与glibc交互,才能和内核通信。相比glibc来说,libstdc++就显得没那么基础了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值