K
Kelsey Bjarnason
[snips]
As in:
if ( x )
{
y();
}
This is, IMO, bad. It clutters code with unnecessary crud. If it helps
because y might be some mucked-up macro that does weird things with block
levels or other sorts of nastiness, I'd tend to focus on the problem -
the macro - rather than this sort of approach.
Then again, I'd tend to try to disallow macros beyond the most trivial in
the first place - use a function, not a macro, if it needs to "do things".
Seriously, it's a reasonable point, but in my defence[1] I generally do my
level best to get the coding standards at a client site changed to mandate
compound statements if they don't already do so. I've had some degree of
success with this.
As in:
if ( x )
{
y();
}
This is, IMO, bad. It clutters code with unnecessary crud. If it helps
because y might be some mucked-up macro that does weird things with block
levels or other sorts of nastiness, I'd tend to focus on the problem -
the macro - rather than this sort of approach.
Then again, I'd tend to try to disallow macros beyond the most trivial in
the first place - use a function, not a macro, if it needs to "do things".