Re: “The right way to do it”
While I wholeheartedly agree that the errno global variable is the wrong way to do it, I don't think it's 100% clear that passing a separate variable is the right solution. As detailed in an earlier message of mine, setting a thread-local error buffer could be another alternative. I haven't seen any rebuttals of why that method would not work. As detailed in my earlier message, performance could be kept good. Further, it would keep the API simple. Simplicity is good. Warren E. Downs
______________________________ Reply Separator _________________________________Subject: Re: [SDL] Huge API change
Author: at internet-mail
Date: 7/28/99 10:21 AM
Please forgive my rant.
On Wed, 28 Jul 1999, Sam Lantinga wrote:
I am ambivalent about the change. It would be the “Right Thing To Do”,
but the API gets more complicated, and the benefit only touches a few
I’m with you Sam. The right thing to do is in fact the right thing to do.
Let’s put this in perspective. One additional parameter per function call
is about as close to zero in performance hit as you can get, so I don’t
want to hear anything about how inefficient this would be. But also, the
errno method was a kludge 30 years ago, and it is today. It’s just the
Wrong Way to do it. Now, people who have learned to deal with the
idiosyncrasies of passing data through global variables have just patched
a sinking ship. It just shouldn’t be done. I can’t count the number of
times that I’ve been screwed by this kind of thinking. But when I learned
to do things the right way, and not rely on “Well, I’ll just have to be
careful, and not do N.” Six months later, I’ll do N and not realize why
the whole system came crashing down.
Thread-safe error handling
Internationalized error messages
Function-specific errors (i.e. no global errno value)
Better defined error conditions
Right on. A well-designed threaded machine kicks the pants of anything in
a single thread. Look at BeOS… then look at MacOS. Anything that
makes threaded programming easier and more stable is a Good Thing.
Adds complexity to the API
Lets make the change now, while we are in v0.9, lest we are stuck with
something yucky for a long long time.
Again, please forgive my rant. I just wanted Sam to know there’s someone
on his side, and lend support.