How to include the header files effectively

Поиск
Список
Период
Сортировка
От Andy Fan
Тема How to include the header files effectively
Дата
Msg-id CAKU4AWoSxnRXTiEuEiDWgizS1LR53ifD63tLYmLGP8gbirz7cw@mail.gmail.com
обсуждение исходный текст
Ответы Re: How to include the header files effectively  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: How to include the header files effectively  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
I find the dependency is complex among header files in PG.   At the same time,  I find the existing code still can use the header file very cleanly/alphabetically.   so I probably missed some knowledge here.

for example,  when I want the LOCKTAG in .c file,   which is defined in "storage/lock.h".  then I wrote the code like this:

#include "storage/lock.h"
...

LOCKTAG tag;


compile and get errors. 

In file included from 
.../src/include/storage/lock.h:21:
/../../../src/include/storage/lockdefs.h:50:2: error: unknown type name
      'TransactionId'
        TransactionId xid;                      /* xid of holder of AccessExclusiveLock */ 

so I HAVE TO 
1.  include the header file which contains the TransactionId 
2.  add it before the lock.h.  

normally I think we can add the dependency in lock.h directly to resolve this issue.

so how can I include header file effectively ?

Thanks

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Should we add GUCs to allow partition pruning to be disabled?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to include the header files effectively