[Ffmpeg-devel] More signed fun

Måns Rullgård mru
Sun Mar 26 17:20:33 CEST 2006


"Ivan Kalvachev" <ikalvachev at gmail.com> writes:

> 2006/3/26, M?ns Rullg?rd <mru at inprovide.com>:
>> Diego Biurrun <diego at biurrun.de> writes:
>>
>> > On Thu, Mar 23, 2006 at 10:32:53AM +0000, M?ns Rullg?rd wrote:
>> >>
>> >> Steve Lhomme said:
>> >> >
>> >> > Depending on how your preprocessor handle data, not using () in macros
>> >> > can lead to problems. Like interpreting (- - variable) (invalid C
>> >> > syntax)instead of -(-variable). Here is a fix.
>> >>
>> >> - -x is perfectly valid C syntax.  If your compiler chokes on it,
>> >> it's broken.
>> >>
>> >> That said, the fix is appropriate for other reasons.
>> >
>> > So will you commit it?
>>
>> Actually, looking closer those parens are not needed at all.  The
>> macro is only used a few times just below the definition, and always
>> with a single number for each argument.  Those parens only add useless
>> clutter in this case.
>
> Bulshit.
>
> Giving that the code that use is:
>  CHECK_BIDIR2( 0,-1, 0, 1)
> I was wondering how it compiles at all, well gcc -E reveield 
> something like this:
> ...
> (- -1<=0 || motion_fx+- -1<=xmax) && (-0<=0 || motion_fy+-0<=ymax) &&
>  (-1<=0 || motion_bx+-1<=xmax) && (-1<=0 || motion_by+-1<=ymax) &&(-
> -1>=0 || motion_fx+- -1>=xmin) && (-0>=0 ||
> ...
> For these who don't use monospace font, there is space between both - -.
> I'm not sure where this space have came from, but i doubt it is part
> of the standard. It is better to don't risk.

Risk what?  That code is perfectly fine and in compliance with all
applicable standards.

> I'm going to commit the following code really soon:
>
> #define CHECK_BIDIR2(a,b,c,d)\
> CHECK_BIDIR((a),(b),(c),(d))\
> CHECK_BIDIR((-(a)),(-(b)),(-(c)),(-(d)))

If you're "fixing" those lines, you should do the same to all the
other similar cases nearby.

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list