Topic: C++ like I've never seen it before


Author: gadget@halcyon.halcyon.com (Timothy Sharpe)
Date: 13 Jan 1995 12:39:49 GMT
Raw View
o Features I'd like in the language
  x return 2 functions up (without macros)
    - a; if (error) return error;
    - heard throw/catch was too slow to use for normal exec paths
  x non execution of call or run time error if I dereferenced 0x00
    - MyObject->fn();
  x statement: exit this fn if anything returns anything except NO_ERROR
    - instead of: hr = a(); if (FAILED(hr)) return hr; blocks
    - or a FAST implementation of throw so I can use it in that case
  x stack of "undos" so if an error happens I can unwind properly
    - not: if (error) { undoA; } b; if (error) { undoB; undoA; }

the latter one seems the most doable.  What is the approved god-coder
approach to that? Of course noting that nested if statements does not
work quickly on RISC machines.






Author: kevlin@wslint.demon.co.uk (Kevlin Henney)
Date: Mon, 16 Jan 1995 13:08:34 +0000
Raw View
In article <3f5sal$hlr@news.halcyon.com>
           gadget@halcyon.halcyon.com "Timothy Sharpe" writes:

>o Features I'd like in the language
>  x return 2 functions up (without macros)
>    - a; if (error) return error;
>    - heard throw/catch was too slow to use for normal exec paths
>  x non execution of call or run time error if I dereferenced 0x00
>    - MyObject->fn();
>  x statement: exit this fn if anything returns anything except NO_ERROR
>    - instead of: hr = a(); if (FAILED(hr)) return hr; blocks
>    - or a FAST implementation of throw so I can use it in that case
>  x stack of "undos" so if an error happens I can unwind properly
>    - not: if (error) { undoA; } b; if (error) { undoB; undoA; }
>
>the latter one seems the most doable.  What is the approved god-coder
>approach to that? Of course noting that nested if statements does not
>work quickly on RISC machines.

Try the existing exception handling mechanism first, and stop listening
to people who like propagating (in)efficiency myths.

All IMHO, of course ;-)

+---------------------------+-------------------------------------------+
| Kevlin A P Henney         | Human vs Machine Intelligence:            |
| kevlin@wslint.demon.co.uk | Humans can wreck a nice beach more easily |
| Westinghouse Systems Ltd  |                                           |
+---------------------------+-------------------------------------------+