[MPlayer-dev-eng] [PATCH] make stream_info_t typedef const etc.

Rich Felker dalias at aerifal.cx
Sat Dec 1 19:53:02 CET 2007


On Sat, Dec 01, 2007 at 05:51:58PM +0100, Reimar Döffinger wrote:
> Hello,
> the easiest way to make the streaminfo structs properly const seems to
> me to make the typedef const, like attached patch does.
> That patch also removes the then useless consts from stream.c and makes
> the auto_open_streams array itself const (to be applied in two or three
> steps).
> Do you agree with this?

Generally I'm against putting const in typedefs. It creates a LOT more
work in the future reversing the mess if anyone ever wants non-const
versions of the type, which would in theory be valid to create and
then pass to interfaces that take pointers to const. It also hides the
const keyword in the interface definitions, making them much less
informative to someone reading them. IMO half the purpose of const is
code documentation (the other half being moving data from .data to
.text or the like).

Rich



More information about the MPlayer-dev-eng mailing list