[Bf-committers] Style issue

Davide Vercelli davide.vercelli at gmail.com
Fri Apr 14 18:44:28 CEST 2006


This is probably a minor issue, so feel free to skip it if you are in a hurry :)

I've noticed that in many parts of the blender codebase the code is
organized like this:

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;

etc.

Now, I can see pros and cons in both methods, but I just wanted to
ask: am I allowed to use the second style when applicable or would
this mean breaking some hidden rule (hidden since I could not find it
in the "coding style" section)?

UncleZeiv


More information about the Bf-committers mailing list