Skip to Content
21st Century C, 2nd Edition
book

21st Century C, 2nd Edition

by Ben Klemens
May 2025
Intermediate to advanced
408 pages
5h 55m
Japanese
O'Reilly Media, Inc.
Content preview from 21st Century C, 2nd Edition

パート II. 言語

ここでC言語のすべてを再考する。

そのプロセスには2つのパートがある。言語のどの部分を使わないかを検討することと、新しいものを発見することだ。新しいものの中には、構造体要素のリストを名前で初期化できるようになるといった構文的な機能もあれば、文字列をそれほど苦労せずに書けるようになる関数など、私たちのために書かれ、今では一般的になっている関数もある。

C言語の基本的な知識を前提としている。初めてこの言語を読む読者は、まず付録Aを読むといいだろう。

各章の内容は以下の通りである:

第6章は、ポインターに戸惑う(あるいは少し不安になる)人たちのためのガイドである。

第7章は、「壊す」ことによって「構築する」ところから始める。一般的な教科書で扱われている概念のうち、軽視されるべき、あるいは非推奨とされるべきと私が考えているものを調査していく。

第8章はその逆で、一般的な教科書ではほんの少ししか触れられていなかったり、完全に抜け落ちていたりする概念を、より深く掘り下げて論じている。

第9章では、文字列に特殊化し、メモリ割り当てや文字カウントの狂いなしに文字列を扱う方法を研究する。malloc 、一度も呼び出すことがないため、孤独になるだろう。

第10章では、より新しい構文を紹介する。この構文を使えば、ISO標準のC言語で、任意の長さのリスト(例えば、sum(1, 2.2, [...] 39, 40) 、名前付けされた new_person (.name="Joe", .age=32, .sex='M').ロックンロールのように、これらの構文機能は私の命を救ってくれた。もしこの機能を知らなかったら、とっくの昔にC言語を捨てていただろう。

第11章はオブジェクト指向プログラミングの概念の解体である。これは多頭のヒドラであり、そのすべてをC言語に翻訳するのは至難の業で利点は限られるが、必要なときに簡単に実装できる側面もある。

あまりに素晴らしく聞こえるかもしれないが、たった1行のコードでプログラミングの速度を2倍から4倍(あるいはそれ以上)にすることができる。その秘密は並列スレッドにあり、第12章では、シングルスレッド・プログラムをマルチスレッド・プログラムにするための3つのシステムを取り上げている。

第13章では、高度な計算をしたり、インターネット・サーバとプロトコルを介して通信したり、データベースを実行したり、その他いろいろなことをするために、ライブラリをどのように構成するかについて説明する。

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Learn C Programming - Second Edition

Learn C Programming - Second Edition

Jeff Szuhay
Tiny C Projects

Tiny C Projects

Daniel Gookin

Publisher Resources

ISBN: 9798341650848