C語言 有一套標準庫,standard library, 對高手而言,可能覺得其功能陽春,所以會介紹其他不錯用的函式庫來補其不及。
但是筆者顯然是基礎條件不足,有時,並不覺得標準庫不好用,一定要用第三方庫。
glibc, 和GLIB 是兩個完全不同的庫。
glibc,是GNU C LIBRARY,GNU版的標準庫,當然會有更大的相容性,更多的外掛功能,相對於其他 C語言實作版本的標準庫而言。
https://www.gnu.org/software/libc/manual/html_mono/libc.html#toc-POSIX-Threads-1
它所依據的標準,來自五個方面,
• ISO C: The international standard for the C programming language.
• POSIX: The ISO/IEC 9945 (aka IEEE 1003) standards for operating systems.
• Berkeley Unix: BSD and SunOS.
• SVID: The System V Interface Description.
• XPG: The X/Open Portability Guide.
在泛UNIX-LIKE的OS裏,主要就是這些標準。
而整個glibc 裏面, 包山包海,要含蓋上面的5個標準,
This is The GNU C Library Reference Manual, for Version 2.20 of the GNU C Library.
• Introduction: Purpose of the GNU C Library.
• Error Reporting: How library functions report errors.
• Memory: Allocating virtual memory and controlling paging.
• Character Handling: Character testing and conversion functions.
• String and Array Utilities: Utilities for copying and comparing strings and arrays.
• Character Set Handling: Support for extended character sets.
• Locales: The country and language can affect the behavior of library functions.
• Message Translation: How to make the program speak the user’s language.
• Searching and Sorting: General searching and sorting functions.
• Pattern Matching: Matching shell “globs” and regular expressions.
• I/O Overview: Introduction to the I/O facilities.
• I/O on Streams: High-level, portable I/O facilities.
• Low-Level I/O: Low-level, less portable I/O.
• File System Interface: Functions for manipulating files.
• Pipes and FIFOs: A simple interprocess communication mechanism.
• Sockets: A more complicated IPC mechanism, with networking support.
• Low-Level Terminal Interface: How to change the characteristics of a terminal device.
• Syslog: System logging and messaging.
• Mathematics: Math functions, useful constants, random numbers.
• Arithmetic: Low level arithmetic functions.
• Date and Time: Functions for getting the date and time and formatting them nicely.
• Resource Usage And Limitation: Functions for examining resource usage and getting and setting limits.
• Non-Local Exits: Jumping out of nested function calls.
• Signal Handling: How to send, block, and handle signals.
• Program Basics: Writing the beginning and end of your program.
• Processes: How to create processes and run other programs.
• Inter-Process Communication: All about inter-process communication.
• Job Control: All about process groups and sessions.
• Name Service Switch: Accessing system databases.
• Users and Groups: How users are identified and classified.
• System Management: Controlling the system and getting information about it.
• System Configuration: Parameters describing operating system limits.
• Cryptographic Functions: DES encryption and password handling.
• Debugging Support: Functions to help debugging applications.
• POSIX Threads: POSIX Threads.
•Internal Probes: Probes to monitor libc internal behavior.
Appendices
• Language Features: C language features provided by the library.
• Library Summary: A summary showing the syntax, header file, and derivation of each library feature.
• Installation: How to install the GNU C Library.
• Maintenance: How to enhance and port the GNU C Library.
• Platform: Describe all platform-specific facilities provided.
• Contributors: Who wrote what parts of the GNU C Library.
• Free Manuals: Free Software Needs Free Documentation.
• Copying: The GNU Lesser General Public License says how you can copy and share the GNU C Library.
• Documentation License: This manual is under the GNU Free Documentation License.
有些人會覺得與其抓很多葉子,不如抓幾根樹幹,顯然glibc也許不是最簡便,但卻是最基礎的。雖然標準化很久了,現在仍以每年一版的速度更新著。