namazu-dev(ring)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memo: libnamazu



Abe Ryuji <raeva@xxxxxxxxxxxx> wrote:

>> libnmz.h ひとつにまとまらない場合はヘッダのインストール先を
>> $(prefix)/include/nmz にしたいところです。今のままだと
>> $(prefix)/include/namazu にインストールされてしまいます。
>
>・libnamazu.hを$(prefix)/includeにインストールして、そこから
>  $(prefix)/include/namazuにある他のヘッダファイルをincludeする
>
>というのはどうでしょうか?

include file を入れ子にするのは避けたいです。

参考: Notes on Programming in C by Rob Pike
      <ftp://ftp.cs.toronto.edu/doc/programming/pikestyle.doc>
|
|      Simple rule: include files should never include include
| files.   If  instead  they state (in comments or implicitly)
| what files they need to have included first, the problem  of
| deciding  which files to include is pushed to the user (pro-
| grammer) but in a way that's easy to  handle  and  that,  by
| construction,  avoids  multiple inclusions.  Multiple inclu-
| sions are a bane of systems programming.  It's not  rare  to
| have files included five or more times to compile a single C
| source file.  The Unix /usr/include/sys  stuff  is  terrible
| this way.
| 
|      There's a little  dance  involving  #ifdef's  that  can
| prevent a file being read twice, but it's usually done wrong
| in practice - the #ifdef's are in the file itself,  not  the
| file  that  includes  it.   The result is often thousands of
| needless lines of code passing through the lexical analyzer,
| which is (in good compilers) the most expensive phase.
| 
|      Just follow the simple rule.

-- Satoru Takabayashi
The most important is that thinking hard about programming
can be both useful and fun.  -- Jon Bentley