So at work, a coworker noticed an issue with the following code:

  for (i = 0; i < n; i++)
    myFREE(foo[i]);

which went away when he wrapped it in braces:

  for (i = 0; i < n; i++)
  {
    myFREE(foo[i]);
  }

Figured maybe it was a weird compiler bug.  Being author of the myFREE()
code -- which happens to be a macro -- I realized immediately what I did
wrong.  (And continue to be annoyed with C syntax ;) )

See, myFREE() is actually a macro that looks like this:

  #define myFREE(x) if ((x) != NULL) FREE(x); x = NULL;

Two statements... hence the need for {} around the call to the macro.
(Or, more sensibly, including {}s around what the macro expands to.)

That was a neat catch. :)

-- 
-bill!
[EMAIL PROTECTED]
http://www.newbreedsoftware.com/
_______________________________________________
vox-tech mailing list
[email protected]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to