Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Sepples

Name: Anonymous 2009-05-23 10:49

Recently I've used C to code a project using SDL, and I think that if I were to start a serious, bigger project I'd really appreciate objects, thus I'm going to use C++ (or Objective-C, but I know nothing about it).
What are the most common pitfalls in C++ I should watch out for?

Name: Anonymous 2009-05-23 15:23

You should know better than to ask /prog/ for advice, especially on Sepples. /prog/ nearly always hates Sepples unless liking Sepples is considered trolling. Most of them would rather troll wank to the shitholes that are LISP and Haskell.

However, in the footsteps of the greatest troll (FrozenVoid), I will HELP HIM.

The most common pitfall is not using Boost for anything that isn't as trivial as "Hello, World!" There's almost no Sepples project that does not benefit from the use of Boost. If you need to do something, consult Boost first so you can see if they've implemented an effective solution first.

The second most common pitfall is using non-smart pointers. Smart pointers cost nearly nothing and improve your program by countless orders of magnitude. The idea behind a smart pointer is that it is a class wrapper to a pointer which gets destroyed when the pointer goes out of scope. Thus, you do not need to concern yourself over the details of destruction without implementing any sort of garbage collection.

Using SDL is a decent idea, it's a great abstraction library, but personally, I find needing to bind myself to the terms of SDL (which is going to change with the next major release - commercial licenses and whatnot) is a strong negative.

Also, it's a pain in the ass to do any sort of useful functions with SDL. SDL only allows you to load .bmp files without SDL_image, you can't do audio without SDL_mixer, and so on and so forth. You end up with like 5 different libraries (plus whatever you need to use the image formats you use, e.g. jpg/png).

In short: SDL is something of a pitfall, depending on your preferences and needs for your project.

Considering that you're coming from C, there are lots of differences you should be familiar with. The biggest ones are having to relearn void * use, malloc, free, etc. Sepples is a major kludge and a hack on C, so be prepared for some confusion. To take advantage of objects, you should be familiar with inheritance and how those work in Sepples (which is pretty unintuitive in most places).

I suggest you Google some reading material on transitioning between C and Sepples, but using Sepples is the fastest way to become familiar with what does and doesn't work.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List