A long time ago you mentioned in passing that postgres.h should be
included before including any system headers. I have been desultorily
changing files to meet that rule, but AFAIK no one's made a pass to
ensure that it's followed everywhere.
Well, now we have a reason it had better be that way: largefile support
will break otherwise. Since we've arranged to define stuff like
_FILE_OFFSET_BITS in pg_config.h which is included by postgres.h, it
is *critical* to read postgres.h before reading any system headers.
Otherwise you are likely to see non-64-bit-aware definitions of library
routines, FILE structs, etc.
regards, tom lane