MugunthKumar/MKNetworkKit — Issue #43: The definition of ELog macro is dangerous!
Author: insanehunter
Created: 2012-01-30 19:37:02+00:00
State: open

I've already [mentioned on twitter](https://twitter.com/ihunter/status/163885155923140608), the definition of `ELog` macro is dangerous.

`ELog` is defined as:

#define ELog(err) if (err) DLog(@"%@", err)

Consider the following usage:

if (someCondition)
ELog(err);
else
SomeAction();

The `if` inside `ELog` will act with `else` in a way not intended by developer.

The workaround for this issue is the same as used in assert macros:

#define ELog(err) do { if (err) DLog(@"%@", err); } while (0)