-
using libgd for images
ok, I'm really just starting with c++, and back in c-land I would use the libgd library to create images.
I gather that I can continue to use it in the same way in c++.
My question is however, _should_ I use it in the same way? i.e. is it the done thing, or best practice, to have c-looking code inside a c++ program? Shouldn't I be putting it all into some class?
Would there be a "c++-way" of incorporating libgd?
-
I don't know about libgd. But c++ is not only a superset of C, it also is designed to make inter operation with legacy C code easy. Nerveless it's often more convenient to build a more or less thin wrap around the C code which helps converting C++ data structures into the format the C-lib expects, or between C and C++ error handling or even offers an object oriented interface. For many C-libraries such a C++ wrapper does already exist. If not you can decide on your own if it's worth to build one (normally it only is inside bigger projects or if you use the C-lib very often).
But it's in now way wrong or bad style to use a plain C lib the C-way inside C++ code.
-
A quick search of the Web brings up this discussion in the libgd bug tracker: iostream feature offered for inclusion.
-
thanks pheres and laserlight .. those comments were really helpful ... gives me a good eye into c++land!
Oh sorry, I meant to say (for other readers really) that I looked up boost and it seems to have some image creation abilities which I will also check out.