[SDL] SDL_CreateThread with C++ method as a parameter
Edward Cullen
eac203 at ecs.soton.ac.uk
Sun Apr 6 12:17:27 PDT 2008
Hi,
I'm curious to know if you're coming to SDL/C++ from Java.
I was taught OO-programming with Java and it would seem that you're
hitting some of the same conceptual stumbling blocks I came across when
I started to do non-trivial programming in C++...
On the assumption that you ARE coming at it from Java, I have some
thoughts that may help you:
C++ isn't Java, that is, the object models in Java and C++ are
different. Java's object model is more 'pure' that C++'s, but that comes
at a HUGE cost (i.e. computational overhead and about 2x the memory
requirements).
This is difference in object models is especially true when you start
mixing C++ and C. It's not nice, it's not pretty (C++ is probably the
worst language aesthetically - after VB LOL), but it's cheap - ie, you
get what you get with as little overhead as possible... and you don't
get a compiler that thinks it's cleverer than you (my #1 gripe with
Java...).
Just to stick up for SDL: I think that you'll find that all the
threading libraries out their do more-or-less the same things, in the
same ways. This is because 99% of them are C-based (because it's
generally more cross-platform than C++) and the theory behind threading
is pretty well understood - there are only so many ways of managing
threads. Incidentally, the SDL Threads API is VERY neat and tidy at
about 20 funcs, compared to the Pthreads (OS-level) API which is about 5
times larger! So, essentially, the problem here is in the way C and C++
interact, rather than with the fundamental design of the SDL APIs (not
that I'm saying they can't be improved).
Every C++ programmer I've ever talked about has raved about Myers'
"Effective C++" and I have to agree. I personally found Stroustrup's own
"The C++ Programming Language" very informative too. Get them out of the
library and re-visit the problem.
Eddy
PS3-690 wrote:
> Since I can't solute the problem, I'll use a another library for threads.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
More information about the SDL
mailing list