[MPlayer-dev-eng] [PATCH] encapsulating #define arguments

Moritz Bunkus moritz at bunkus.org
Mon Jan 13 15:01:11 CET 2003


Hi.

> hmm. about half of your patch is ok, but the other half is just
> useless (for example putting demuxer struct pointers to ()),
> and just changes the macros unreadable :(

Naturally I expected my patch to be over-done, but I wanted to hear
exactly what you would object to. So I'll redo the patch and leave out
the things you don't find useful.

> >  #define M_ST_OFF(struct_type, member)    \
> > -    ((void*) &((struct_type*) 0)->member)
> > +    ((void*) &(((struct_type)*) 0)->(member))
> 
> any examples when this can change anything?

Not really. It was used dumb 'find every occurence and fix it'.

> so it's ok for mp_msg() stuff, for min()/max() and so, but imho it should
> not be done for stuff where args are pointers to some struct or are typedefs.

Ok, I'll post a follow-up later on.

> maybe also pointers to elementary types (char*, void* etc) are ok to change,
> as they can be used in arithmetic too (example: strcpy(dst+8,src+2), but i
> can't imagine case when dst and (dst) can make difference in effect)

Hmm... 

mystrcpymacro(mydst == NULL ? otherdst : mydst, mysrc);

Wouldn't this be '(otherdst) OR (mydst + 8)' ? These are arithmetics so
they should be changed IMHO.

-- 
 ==> Ciao, Mosu (Moritz Bunkus)


More information about the MPlayer-dev-eng mailing list