Messages in this thread | | | Date | Tue, 16 Sep 1997 10:35:09 -0600 (MDT) | From | Teunis Peters <> | Subject | Re: patch for 2.1.55 pre-1 minix/sysv/affs |
| |
On Fri, 12 Sep 1997, Linus Torvalds wrote:
> > > On Fri, 12 Sep 1997, Manong Dibos wrote: > > > > Perhaps if C had good exception handling throw(), try{}, catch(){}, all > > this farting around with if()'s could be made a lot more streamlined... > > Just throw an exception at the first hint of a deviation from the "norm". > > Sure. We'd also be about 500 times slower. > > Exception handling is _complex_. That translates into slow.
I dunno - implementing it with setjmp/longjmp seems pretty fast to me :) [but what do I know] - FWIW - Watcom C++ 10.0+ has really fast exceptions (don't have speed impact - suspect they do far jumps)
Slow? Unless GCC uses same methods as Borland/Microsoft it shouldn't be slow.... "if [cond] (set value; jump)" ~= "if [cond] return <value>"
The 'catch' I suppose might be complicated though. [I could post my scheme and see what people think... it's entirely userspace though... and not thoroughly tested <yet>]
> There's nothing wrong with "goto"s, especially for handling "error" cases > (ie anything that throws us out of the normal flow of control). Using an > explicit goto is often clearer than trying to hide things behind "pretty" > constructs, and it's almost always a lot faster.
I agree - with setjmp/longjmp to handle 'gotos' beyond the local function area... is there a more efficient way? [working on a new binary format (for almost a year now)... object-based but trying to be as fast as possible because it has to support RT VR-system]
> Linus "Pascal and Ada considered harmful" Torvalds
<grin> - Agreed. I lumped C++ here too until I discovered GNU C++ :)
G'day, eh? - Teunis
| |