Michael Niedermayer <michaelni at gmx.at> writes:
On Sat, Jul 17, 2010 at 08:28:54PM +0100, M?ns Rullg?rd wrote:
Michael Niedermayer <michaelni at gmx.at> writes:
The file could also use a stdint.h #include.
thats unneeded from what i remember stdint.h or inttypes is amongth the ones included by avfilter/avutil/... main header which we include already.
There is no promise this will remain the case.
its certain that inttypes or stdint will be included by the main headers because their types are used by the public api all over the place.
The API could in theory change, but fair enough.
All files should include whatever headers they need directly, even if one happens to be indirectly included by another.
i faintly remember you saying you didnt mind the main headers or common.h being used instead of repeating the standard includes in them in every file. but maybe i misremember or it was someone else ...
either way, litterally the rule of "All files should include whatever headers they need directly, even if one happens to be indirectly included by another."
Is not implementable unless you provide a automated way to detect such missing includes. Thats besides the wasted time enforcing such rule would lead to and it might also slow compilation down with some compilers.
I'm not suggesting anyone spend great amounts of time hunting for exactly what is needed. However, if for example you use any of the av_str* functions, I think it is reasonable to know these are declared in avstring.h and include that. If something is missed, it's no big deal. The reason I want this guideline is that it reduces the amount of cleanup needed if an include is ever dropped from a header. These things happen, and chasing down every optionally built file that might need updating takes time. -- M?ns Rullg?rd mans at mansr.com