"Ronald S. Bultje" <[email protected]> writes:
> Hi,
>
> On Sun, Jan 29, 2012 at 9:34 AM, Aneesh Dogra <[email protected]> wrote:
>> +#define SQUARE(x) x*x
> [..]
>> -static inline int square(int x)
>> -{
>> - return x*x;
>> -}
>
> Why? This code will do exactly the same thing.
Actually it will not always do the same thing. The macro evaluates the
argument twice, which may have unexpected consequences. Consider this:
int *x, y;
// code
y = SQUARE(*x++);
--
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel