|
Boost : |
Subject: Re: [boost] 5 Observations - My experience with the boost libraries
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2010-03-23 20:07:45
On Tue, Mar 23, 2010 at 4:54 PM, David Bergman
<David.Bergman_at_[hidden]> wrote:
> On Mar 23, 2010, at 7:40 PM, Tom Brinkman wrote:
>
>>>> To you. There are many graphics shops that make extensive use of c++
>> *and* boost.
>>
>> Not true. Sure, we use C++ around the edges. The actual graphics code is
>> all done in C. There are no popular C++ graphics libraries. Sorry. Its
>> not possible, graphics libraries require hardware acceleartion.
>
> I never understood this idea that some libraries were not
> possible to build in C++?
If you're looking for something that makes C++ worse than C for
graphics programming, you won't find it simply because C++ is a
superset of C. Anything you can do in C you can do in C++ too.
I believe what Tom means is that the graphics interfaces typical C++
programmers design are not as good as graphics interfaces designed by
C programmers. From that point of view, C++ programmers do have a lot
to learn from C programmers. There is nothing more encapsulating and
more abstract than a basic C interface:
struct foo;
foo * create_foo( ..... );
void frobnicate( foo * );
void destroy_foo( foo * );
For such interfaces, the most important thing is to physically
decouple the user from implementation details. Templates and classes
are useless for that.
There are only two benefits of using C++ even for such C-style interfaces:
1) Use exceptions to report errors.
2) Use shared_ptr instead of relying on users to call destroy.
The latter is not too important because even the pure C interface can
easily be wrapped in a shared_ptr by the user.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk