[FFmpeg-devel] [FFmpeg-cvslog] avformat/rtpdec_asf: fix compiler warning about const qualifier being discarded

Michael Niedermayer michaelni at gmx.at
Fri Aug 29 15:50:50 CEST 2014

On Thu, Aug 28, 2014 at 05:22:42PM -0700, Timothy Gu wrote:
> On Aug 28, 2014 6:14 AM, "Michael Niedermayer" <michaelni at gmx.at> wrote:
> >
> > buf is assigned to AVIOContext.buffer, which is written to by some
> > functions using AVIOContext
> Doesn't const only apply to this particular function? In other words,
> doesn't const only guarantee that it is not changed inside this particular
> function?

if the function has a access to a non const version of the pointer
it very well can change its content like in func(dst, dst); where one
is const and the other is not


from the link below
"From the C99 specs (6.7.3 Type qualifiers):

     If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is undefined.

from http://stackoverflow.com/questions/8836418/is-const-casting-via-a-union-undefined-behaviour
(maybe not the clearest and best reference to it but thats what i


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140829/7d0f1ac5/attachment.asc>

More information about the ffmpeg-devel mailing list