Message-ID:
Content-Type: text/plain; charset=us-ascii
Windows has these too. They’re like globals but thread-specific.
I know what they are 
As you say, they’re like globals: a design fault.
Used correctly, globals have no reason to be a design fault: after
all, that’s what C’s functions are, globals (well, that and
file-statics)
.> Date: Wed, 10 Jul 2013 22:50:46 +1000
From: john skaller
To: SDL Development List
Subject: Re: [SDL] Thread local storage API
On 10/07/2013, at 10:34 PM, Sik the hedgehog wrote:
Date: Thu, 11 Jul 2013 05:00:08 +1000
From: john skaller
To: SDL Development List
Subject: Re: [SDL] Thread local storage API
Message-ID:
<5CDA3552-B72B-484B-AE5F-1A0005D86B92 at users.sourceforge.net>
Content-Type: text/plain; charset=us-ascii
On 11/07/2013, at 2:42 AM, Alexander Sabourenkov wrote:
When one desperately wants to shoot himself, he will settle with just
a foot, if the framework won’t allow him to blow his head off and be
done with it. So why bother? Not forcing shot feet and crutches on
people is good enough.
The way I see it is that programming languages are there to support
good design. Otherwise we’d just write hex codes (like I used to
in the old days 
Programming languages exist to make it easier to program. Sometimes
this means protecting you from yourself (any pure-functional language,
I would assume), sometimes this means giving you the firepower to
shoot the other side of the planet via your foot (C, C++), sometimes
this means keeping you within certain design constraints. It all
varies.
Date: Thu, 11 Jul 2013 06:02:02 +1000
From: john skaller
To: SDL Development List
Subject: Re: [SDL] Thread local storage API
Message-ID:
<6E7E70A1-2C9B-4DA8-BAAD-99DBB0EA6A0E at users.sourceforge.net>
Content-Type: text/plain; charset=us-ascii
On 11/07/2013, at 5:14 AM, Sik the hedgehog wrote:
Technically SDL uses return values to indicate when a function failed.
So does Posix. But it doesn’t indicate what kind of error it is.
That’s the only thing you should pay attention to if you care about
error handling,
That’s not so if the kind of error matters.
and that’s even better than the stack because it
doesn’t even need to touch RAM (it can stay entirely within CPU
registers).
In principle, that’s the stack (auto storage in C).
The use of registers for the top of the stack is an optimisation.
Many CPU’s have no such registers (eg SPARC uses a register
file on the stack and relies on the cache instead. The TI 990
only has ONE register and this is one of the best designs ever).
SDL_GetError merely shows the same error as a string explaining what
happened.
Ah yes. So adding the error code as a parameter would and returning the
error code would be the way to go:
int error = function arguments;
if (error) {
char *estring = SDL_GetErrorString (error);
printf (“Error %s\n”, estring);
exit(1);
}
…
This code is re-entrant. Even better:
char *estring = SDL_GetUTF8ErrorString (language, error);
so now the language is provided as a key was well, which makes
internationalisation much easier. [Do not use C locales they’re
not re-entrant … broken design again]
Unless you’re writing a multi-seat app (which admittedly might be
relevant: never discount the ability of big-iron to stay efficient)
you wouldn’t need the language key, just a way to set the current
language (which admittedly might be what you mean by non-reentrant).
And no, we can’t get rid of SDL_GetError because the ABI was frozen.
Backwards compatibility is more important here.
It is unfortunate that backwards compatibility ensures design bugs
are immortal 
The way to do this is clearly mark bad features DEPRECATED
and then actually remove them in the next version.
The last time I suggested this route, I said 2-4 versions down the
line, instead of one. Move the declarations to another file that gets
included where they’re supposed to be and drop them from the
documentation, and most people won’t even realize they exist, making
it much easier to drop them later.
Breaking bad code is important. It has to be done or the whole project
gets locked into an untenable situation where it cannot be upgraded.
Continuous pain is better than sudden death 
IMHO of course.
Don’t forget sudden pain: the sensation of a function suddenly
disappearing after you’ve had an app in the wild that uses it for
several years. The pain to the SDL codebase isn’t the only issue here.
Date: Wed, 10 Jul 2013 15:13:31 -0700 (PDT)
From: Mason Wheeler
To: SDL Development List
Subject: Re: [SDL] Thread local storage API
Message-ID:
<1373494411.31210.YahooMailNeo at web122504.mail.ne1.yahoo.com>
Content-Type: text/plain; charset=“iso-8859-1”
Quick question.? Let’s say that someone is using SDL with Delphi, which
implements thead-local storage as a language feature and has some data (for
exception handling) already set up to use TLS as part of the runtime.? Will
having another system that tries to implement TLS loaded into the same
process end up clashing with it and breaking stuff?
Shouldn’t (at least under Windows, but is Delphi currently available
anywhere else?), but valid question. It really just depends on how
it’s done. If Delphi somehow garbage collects all TLS then that could
cause some sort of access violation. If SDL just assumes a particular
TLS slot is always available then that could do much the same. If
neither of those is true, then you should be fine.