PDA

View Full Version : I feel.....clean....



jdinger
04-10-2003, 09:01 PM
I've spent most of today upgrading the code for my game to replace my arrays and char* strings with STL containers and strings.

While I was at it I started thinking about my old-style C macros. Where I use to have:


#define SafeRelease(DirectXptr) {if(DirectXptr) {DirectXptr->Release(); DirectXptr=0;}}


I now use:


template<typename _T> inline void SafeRelease(_T T)
{
T->Release();
T=0;
}


It's the kind of feeling when I first moved from VB to C++ for writing games. Like I was doing something "naughty" before....:eek:

Xei
04-10-2003, 11:21 PM
Whatever method works man. :)

*ClownPimp*
04-10-2003, 11:45 PM
didnt someone recently post a quote from some guy saying never use STL in games? :D

Shadow12345
04-11-2003, 06:12 AM
oh 'some guy' said that huh? Well obviously he's very popular, it's not everyday 'some guy' says something useful!

jdinger
04-11-2003, 06:46 PM
Originally posted by *ClownPimp*
didnt someone recently post a quote from some guy saying never use STL in games? :D

Not sure what 'guy' said that or for what reason but I haven's seen any speed difference on 3 different machines since I've upgraded to STL.

I remember someone recently posting that they read 'somewhere' that C++ was too slow for games.

To both that and the idea that STL is too slow: If you don't understand how to use it then of course it would be too slow.

But like I said I'm just learning iterators, etc. and I haven't noticed a difference (this is on machines ranging from P2 166 mhz - 64 MB Ram to P4 1.8 ghz 256 MB Ram).

Of course different situations require different solutions. For my file I/O I prefer C functions/data structures because I don't need all the added functionality of fstreams.