Bjorn,

> > I have been trying to think of situations where there might be more than
> > two ways of doing things in C.  I have not been able to think of any
>
>You could extend on your switch/if example by adding lookup tables.
>
>Error handling is another potential candidate. For example, how do
>you exit from a function in case of an error?

This is certainly a situation requiring a decision.  In the original algorithm
design an error handling strategy will be chosen.  It is likely to be done
after some thought.  Of course as code evolves an alternative strategy
might be better.

In the case of error handling the decision is often program wide.  So
changing a single function may have global, rather than local, implications.

I see the if/switch decision as being a local one that is likely to be
made on the fly as developers change the code.  Not a global one
that they would think about away from a terminal.

John Pane sent me the example:

i++, or ++i, or i+=1, or i=i+1

I would argue that the first two were the only ones likely to be
considered.  Developers are inculcated from an early age that
incrementing a variable by one means using ++.  I would doubt
the alternatives would no more pop into their heads than i=i+3-2;

The which is best debate over ++i and i++ springs to life on
mailing lists with some regularity.  Some of the rationals put
forward are truely staggering.


derek

--
Derek M Jones                                            tel: +44 (0) 1252 
520 667
Knowledge Software Ltd                            mailto:[EMAIL PROTECTED]
Applications Standards Conformance Testing   http://www.knosof.co.uk



- Automatic footer for [EMAIL PROTECTED] ----------------------------------
To unsubscribe from this list, mail [EMAIL PROTECTED]  unsubscribe discuss
To join the announcements list, mail [EMAIL PROTECTED] subscribe announce
To receive a help file, mail [EMAIL PROTECTED]         help
This list is archived at http://www.mail-archive.com/discuss%40ppig.org/
If you have any problems or questions, please mail [EMAIL PROTECTED]

Reply via email to