When defining macros that headers rely on, such as _FILE_OFFSET_BITS
, FUSE_USE_VERSION
, _GNU_SOURCE
among others, where is the best place to put them?
Some possibilities I've considered include
- At the top of the any source files that rely on definitions exposed by headers included in that file
- Immediately before the include for the relevant header(s)
- Define at the
CPPFLAGS
level via the compiler? (such as-D_FILE_OFFSET_BITS=64
) for the:- Entire source repo
- The whole project
- Just the sources that require it
- In project headers, which should also include those relevant headers to which the macros apply
- Some other place I haven't thought of, but is infinitely superior
A note: Justification by applicability to make, autotools, and other build systems is a factor in my decision.