Gurjeet Singh <singh.gurj...@gmail.com> writes: > I noticed that xlog.h uses PGDLLIMPORT, but it does not include c.h > directly or indirectly.
In general, all include files in Postgres assume that you've included postgres.h or postgres_fe.h (as appropriate) first; and practically all of them have far more dependencies on that than you mention here. If we were to decorate them with explicit inclusions such as you propose, we would accomplish little except to bloat the sources and slow down compilation. The general rule about that is "thou shalt have no other gods before c.h" --- that is, it is *necessary* that c.h be included before anything else, in *every* Postgres file. Otherwise you can run into platform-specific problems. An example I remember is individual files having different ideas of whether 64-bit or 32-bit filesystem APIs are in use, as a consequence of <stdio.h> being read before pg_config_os.h has defined symbols controlling that. Needless to say, this doesn't work well at runtime. You can find actual examples of that sort of thing in the archives from years ago, before we began to enforce the rule rigidly. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers