[rakuten:book:10741013:detail]

第7章 関数

人間は反復し、神は再帰する。 L.Peter Deutch


L Peter Deutsch or Peter Deutsch (born Laurence Peter Deutsch) is the founder of Aladdin Enterprises and creator of Ghostscript, a free software PostScript and Pdf interpreter.
Deutsch's other work includes the definitive Smalltalk implementation that, among other innovations, inspired Java just-in-time technology 15 or-so years later. He also wrote the PDP-1 Lisp 1.5 implementation, Basic PDP-1 LISP, "while still in short pants" between the age of 12-15 years old.
He is also the author of a number of RFCs, and the The Eight Fallacies of Distributed Computing.
Deutsch received a Ph.D. in Computer Science from the University of California, Berkeley in 1973[1]. He has done stints at Xerox PARC and Sun Microsystems. In 1994 he was inducted as a Fellow of the Association for Computing Machinery.
Deutsch changed his legal first name from Laurence to L on September 12, 2007[2]. His published work and other public references before that time generally use the name L. Peter Deutsch (with a dot after the L).
[edit]References

今回、通読したところは、「章のタイトル」がとても抽象的なので、危険だと思いました。
プログラミングを、論じていくうえで、「関数」というのは、とてもよく使う単語。
よく使うということは、他の言語についての知識とバンバン関連するので、C++の全体像をフォローしておかないと、たちまち、筆者のペースについていけなくなる。
それと、今回、この章のラストには、「マクロ」というものが登場する。
趣旨は、「マクロはあまり使うな」ということだから、ほうっておいてもいいのかなと思うけど。
この本も、読者に要求すること多すぎです。
思えば、「ゲームプログラマになる前に・・・」の本も、一体、C++にどこまで習熟したら、本書のソースコードのハックができるのかということはあいまいだと思う。
具体的に、入り口に突撃しようとした途端に、霧につつまれるような不気味な状態になる。
この気持ち悪さに耐えないといけない。

「完璧なものいがいは、うけいれることができない」

この発想は、早急にすてたほうがいい。


目次

7-1 関数宣言
 7-1-1 関数定数
 7-1-2 静的変数
7-2 引数渡し
 7-2-1 配列引数
7-3 戻り値
7-4 関数名の多重定義
 7-4-1 多重定義と戻り値の型
 7-4-2 多重定義とスコープ
 7-4-3 あいまいさを取り除くための手作業
 7-4-4 複数の引数の解決
7-5 デフォルト引数
7-6 個数が指定されていない引数
7-7 関数ポインタ
7-8 マクロ
 7-8-1 条件コンパイル
7-9 アドバイス
7-10 練習問題

>|C++|
inline int fac(int n) { return (n<2)?1: n*fac(n-1);}
|