[ros-dev] Error handling
psusi at cfl.rr.com
Mon Apr 11 17:42:03 CEST 2005
Eric Kohl wrote:
> Hello Philp!
> Great to see you're back!
Thanks! It is good to be back.
> At the time I wrote this code it was more important to make it work
> reliably than to make it look good. File I/O has been pretty instable at
> this time because of several bugs in the io manager and the cache
> manager. That's why I wrote it this way; it worked in most cases! ;-)
Right, and handling errors that way is a VERY common practice in C, but
still is bad and should be improved somehow, which is why I brought this
up. Whatever better practice we decide on, we need something to replace
this methodology with in the future.
> I still prefer using the bare gotos because in my opinion it is a lot
> easier to read. But otherwise I agree with your improvements.
Yea, I liked the bare gotos at first too, but got to thinking that there
is still a good bit of duplicate code in there that could be cleaned up.
Plus using the gotos still gave me an icky feeling. Specifically
every time you assign the return to Status and call NT_SUCCESS to decide
if you should goto, so I came up with the macro to cut down on all the
retyping of duplicate code. I'm still trying to think of a way to do it
that gives the best of both worlds; looks good, yet avoids duplicate
code. Wrack your brain and see if you can come up with something.
Steven Edwards wrote:
> We have PSEH which can be used.
Thomas Larson wrote:
> i think thats the most simple and easy to read
> but in the end is´ent it not a littel waste of time
> discusse old functions their need rewrite anyway..?
How is it a waste of time? What good is rewriting the functions if they
aren't written better the next time around? If that is going to happen
then we need to discuss how to do it better.
More information about the Ros-dev