-
October 20th, 2003, 04:24 PM
#1
Size of try/catch blocks
If I have a very large function body which contains several
calls to functions which throw similar exceptions is it less
costly to have several try/catch blocks or one try/catch block
for the entire function body. Lets assume that the catch blocks
all perform the same function.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
October 20th, 2003, 04:37 PM
#2
well if they perform the same function, then why not catch(...) unless you are looking at the exception....so I know soul this isn't what you are looking for, so explain a bit more....
-
October 20th, 2003, 04:53 PM
#3
what is mean is say F1, F2, ...., FN throw exceptions
and I have
PHP Code:
void FOO()
{
F1();
...
F2();
...
...
...
FN();
}
As I understand it (which is not very well) I am going to pay
a price for having to keep track of code within try/catch for
stack unwinding. Now is this price worse if I use
PHP Code:
void FOO()
{
try
{
F1();
...
F2();
...
...
...
FN();
}
catch
{
}
}
as oppossed to
void FOO()
{
try
{
F1();
}
catch
{
}
...
try
{
F2();
}
catch
{
}
...
...
...
try
{
FN();
}
catch
{
}
}
Now maybe this is a dumb question and the difference is insignificant.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
October 20th, 2003, 05:02 PM
#4
Ok...
just one try and multiple catchs...it matters not what is thrown, that a catch is there...you could disassembly it and look, but I would gather that the optimizer for the compiler would be the same....and no I haven't looked dumpbin /disasm .exe/.dll if your interested...
-
October 20th, 2003, 05:07 PM
#5
Got it Mick, thanks...
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
October 20th, 2003, 08:31 PM
#6
Bobby Schmidt's 17 part exception series in the MSDN talks about
some overhead in section 4: even looks at the generated asm.
Maybe some details for you ? Probably different in VC7.
Handling Exceptions in C and C++, Part 4
-
October 20th, 2003, 10:32 PM
#7
Originally posted by mdmd
Bobby Schmidt's 17 part exception series in the MSDN talks about
some overhead in section 4: even looks at the generated asm.
Maybe some details for you ? Probably different in VC7.
Handling Exceptions in C and C++, Part 4
You should have stated at part 1....these go to 17,,,,
-
October 20th, 2003, 11:04 PM
#8
Originally posted by Mick
You should have stated at part 1....these go to 17,,,,
I started from 17 and went backwards thinking he wouldn't be
"spelunking a tiny way into assembly language" untill the
end; I never made it to part 1.
Its good enough to read through again fully. Next time I'll start
from Handling Exceptions in C and C++, Part 1
-
October 20th, 2003, 11:13 PM
#9
Originally posted by mdmd
I started from 17 and went backwards thinking he wouldn't be
" spelunking a tiny way into assembly language" untill the
end; I never made it to part 1.
Its good enough to read through again fully. Next time I'll start
from Handling Exceptions in C and C++, Part 1
I only glanced through...seemed like a good read, and after all it's 17 parts..what can be wrong with that??? unless yer a liberal then it's really wrong
-
October 20th, 2003, 11:47 PM
#10
Thanks MDMD that is what I needed...information.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|