On 25/11/13 16:41, John Stebbins wrote:
> Just verifying, this is the preferred style? Because I see several
> other places in the code that enclose single lines in braces.
Basically
if (!foo)
bar = small_function(a, b);
if ((large condition()) != blah)) {
bar = do_something_with_a_(lot, of, args,
and + computation,
over more lines);
}
In words, if the condition is short and/or the single line conditional
statement is short and it isn't the last item of an if () { } else {},
drop the braces, keep them otherwise.
> I even
> see some other pending patches that are adding code that does this. I
> prefer the extra braces for readability and it makes it so future
> patches don't require as much formatting changes.
Personally I do agree, but the coding style is a compromise =)
> And treating pointers as booleans is a pet peeve of mine. The code
> is more self documenting if you compare pointers to pointers, ints to
> ints and save boolean operators for things that are truly meant to be
> boolean. But if this is libav way, I won't say any more about it.
Thank you =)
lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel