[Ffmpeg-devel] some quick questions about swscaler integration
Sun Mar 19 04:52:17 CET 2006
Colin Ward <lists at codehq.org> writes:
> M?ns Rullg?rd wrote:
>> There may be files that implicitly make this assumption, but it is
>> not a decided practise. All files (*.c and *.h) #including
>> everything they depend on makes for the least trouble in the long
>> run. If (unlikely) all dependencies on inttypes.h were removed
>> from avcodec.h, someone might (rightly) decide to remove the
>> #include <inttypes.h> from it. This would break compilation of any
>> file that depends on avcodec.h having this #include. Some morons
>> will tell you that header files should never #include other header
>> files. These people are hopelessly misguided and should be either
>> ignored or shot.
> Ok, I'll bite.
> Maybe those hopelessly misguided morons have been badly bitten at
> some point by the dreaded circular dependency problem where header
> "a" required header "b" and header "b" required header "a" and they
> had to stuff around for ages trying to fix it. I know that I have
> been bitten by that problem badly in the past, and I now try to
> forward declare as much as possible in header files in order to
> reduce the number of header files included, to avoid the
> possibility of these problems. It certainly has made life easier
> and has not caused me any problems whatsoever.
I have worked on projects where headers didn't #include their
dependencies. Ever so often someone would fail to hunt down the right
header to include for some specific function, and the headers required
for everything else defined in that header that wasn't really needed
in that particular case, and so on. Instead, they'd simply stick an
"extern foo" at the top of the C file, thus making the compiler happy.
The problems become obvious when you realize that many of these rogue
"extern" declarations do not match the definition of the symbol. Now
there's something that bites.
> So why does that make me a hopelessly misguided moron?
If, after reading the above, you continue to insist that recursive
#includes can be bad, I'm afraid I'll have to call you something not
too flattering. Not knowing your tools is bad, but sometimes
excusable. Refusing to learn is moronic.
mru at inprovide.com
More information about the ffmpeg-devel