[FFmpeg-devel] [PATCH 1/4] Remove unnecessary mem.h inclusions

Anton Khirnov anton at khirnov.net
Thu Feb 4 18:17:01 EET 2021


Quoting Nicolas George (2021-02-04 15:48:03)
> Anton Khirnov (12021-02-04):
> > I don't think we have an official project policy on this, but I would
> > be in favor of something like:
> > 
> >     All installed headers are only guaranteed to provide those
> >     identifiers that are explicitly declared in them. Users must not
> >     rely on an installed header #include'ing any other specific headers,
> >     as those can change at any time.
> 
> That would probably be ok, but I would suggest to add:
> 
> ... explicitly declared or used in them.
> 
> If a function argument is size_t or int64_t, then we can expect size_t
> or int64_t to be defined.

That leads to undesirable situations, such as:
- header avfoo.h declares 'int64_t av_foo(void);'
- people start using av_foo() in their code, but do not include
  <stdint.h> because avfoo.h includes it for them
- at some later point av_foo() is deprecated and removed
- everyone depends on avfoo.h to provide int64_t, even though avfoo.h
  does not use it anymore

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list