[FFmpeg-devel] [PATCH] Optimization of original IFF codec

Måns Rullgård mans
Mon Apr 26 03:48:55 CEST 2010

"Ronald S. Bultje" <rsbultje at gmail.com> writes:

> Hi,
> On Sun, Apr 25, 2010 at 5:15 PM, Sebastian Vater
> <cdgs.basty at googlemail.com> wrote:
>> Ronald S. Bultje a ?crit :
>>> On Sun, Apr 25, 2010 at 12:47 PM, Sebastian Vater
>>> <cdgs.basty at googlemail.com> wrote:
>>>> + ? ?const unsigned b = (buf_size * 8) + bps - 1; \
>>> Shouldn't be const, I think (?).
>> Of course this should be const, since it isn't going to be changed. I
>> moved this just out of the for, because gcc was too stupid to do the
>> calculation outside of the loop.
> Out of loop isn't the same as const. Const means it never changes,
> ever. It means that the value is the same, regardless of input values
> to the function call. So regardless of buf_size, bps, b always has the
> same value.

No, that's not what it means.  A local variable with a const qualifier
means simply that the value of the variable cannot be changed after
the initialisation.  If an attempt is made to assign a value to it
later, the compiler must issue an error.  Other than that it has no
effect at all.

Perhaps you confused it with "static const" symbols, which indeed have
a fixed value although their scope is limited to the enclosing block.
These, however, must be initialised by a constant expression.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list