[FFmpeg-devel] [PATCH 2/4] cbs: Remove useless initializations
andreas.rheinhardt at gmail.com
Mon Jun 3 15:07:00 EEST 2019
> On 03.06.2019, at 00:37, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
>> Up until now, a temporary variable was used and initialized every time a
>> value was read in CBS; if reading turned out to be successfull, this
>> value was overwritten (without having ever been looked at) with the
>> value read if reading was successfull; on failure the variable wasn't
>> touched either. Therefore these initializations can be and have been
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
>> And? What did the ancient compilers say?
> Not sure how to read that, but some compilers probably produce "may be used uninitialized" warnings after this change.
> IMHO it would be better to need evidence of an advantage to remove variable initialization for non-trivial code, even if they are unnecessary. Your commit message doesn't seem to mention one at least.
> But I am happy to let some maintainer have the last word.
This comment refers to what Mark said in his review  of an earlier
version of this patchset. He explicitly mentioned that (if his memory
is right) an older compiler warned without the initializations.
And I actually thought that there is no need for a further reason to
remove unnecessary initializations despite the usual ones: Speed and
code size. E.g. the size of my cbs_mpeg2.o went down from 30421 B to
29445 B after this patch; for cbs_h2645.o the numbers are 249605 B
and 242245 B. These macros are used a lot (mostly indirectly via other
macros); see the various cbs_*_syntax_template.c files for that.
More information about the ffmpeg-devel