[MPlayer-cvslog] r22298 - in trunk: Makefile command.c command.h m_property.c m_property.h mp_core.h mplayer.c

Uoti Urpala uoti.urpala at pp1.inet.fi
Thu Feb 22 18:57:33 CET 2007


On Thu, 2007-02-22 at 18:29 +0100, Reimar Döffinger wrote:
> > No that is not valid. Looks like it was miscompiled. The C99 standard
> > says (part 6.5.2.5) "String literals, and compound literals with
> > const-qualified types, need not designate dintinct objects". There is
> > nothing const-qualified about that.
> 
> Huh? If there is nothing const-qualified about this, the cited part does
> not say anything at all about this case...

The spec doesn't explicitly say "non-const objects must not be in
read-only memory", but I think that can be assumed. This part can also
be thought to be relevant:

5. If the type name specifies an array of an unknown size, the size is
determined by the initializer list as specified in 6.7.8, and the type
of the compound literal is that of the completed array type. Otherwise
(when the type name specifies an object type), the type of the compound
literal is that specified by the type name. In either case, the result
is an lvalue.

Note "type ... specified by the type name", no magically added "const".
Also example 5 is

The following three expressions have different meanings:
"/tmp/fileXXXXXX"
(char []){"/tmp/fileXXXXXX"}
(const char []){"/tmp/fileXXXXXX"}
The first always has static storage duration and has type array of char,
but need not be modifiable; the last two have automatic storage duration
when they occur within the body of a function, and the first of these
two is modifiable.




More information about the MPlayer-cvslog mailing list