B
Ben Bacarisse
Richard said:Ben Bacarisse <[email protected]> writes:I would write the switch as an if because there are really only two
cases:
if (i < 2)
table = i;
else table = table[i-1] * 2;
and I would really want to write:
table = i < 2 ? i : table[i-1] * 2;
but coding style in force might prevent me. I like conditional
expressions because they often seem to make more explicit what the
pattern really is but they seem to be out of favour with bosses.
Which is strange because your use of "?:" is identical and if someone
can not read that as C then, IMO, they have no place modifying the
code.
Some bosses object to such code because it is not "debugger
friendly". I have seen people complain about forms like
return *error = NO_SPACE, NULL;
on similar grounds.