[Bf-committers] Style issue
Alexander Ewering
blender at instinctive.de
Fri Apr 14 19:46:40 CEST 2006
On Fri, 14 Apr 2006, Davide Vercelli wrote:
> r1 = get_res_1();
>
> if (r1) {
> /* do stuff */
> r2 = get_res_2();
> if (r2) {
> /* do stuff */
> r3 = get_res_3()
> if (r3) {
> /* and so on indenting... */
> }
> }
> }
>
> On the other hand I prefer to organize my code like this:
>
> r1 = get_res_1();
> if (!r1)
> return; /* or break, or continue */
>
> r2 = get_res_2();
> if (!r2)
> return;
Both styles are used - for example, at the beginning of draw_object(), the
second style is used..
Also, there's of course always this, which is my preferred style in simple
situations :)
if (get_res_1() && get_res_2() && get_res_3()) {
}
:)
| alexander ewering instinctive mediaworks
| ae[@]instinctive[.]de http://www[.]instinctive[.]de
More information about the Bf-committers
mailing list