godecho

Members
  • Content count

    112
  • Joined

  • Last visited

Community Reputation

235 Neutral

About godecho

  • Rank
    Member
  1. a good way to debug

    Quote:Original post by Servant of the Lord As far as I know, most people use simple #defines to display things only when in debug mode. This is, at least, what's been taught to me in more than one book. #ifdef DEBUG_MODE #define PrintDebugMessage(x) printf(x) #else #define PrintDebugMessage(x) { } #endif If you are debugging, you can have #define DEBUG_MODE at the top of your header file, and if you are in release mode, you can have that line commented out. Most compilers already define something like _DEBUG when you're compiling in debug mode. http://msdn.microsoft.com/en-us/library/b0084kay(VS.71).aspx
  2. a good way to debug

    Are you using this mechanism for logging or debugging? If you're trying to debug, a good debugger I think would be a much better choice. If you're logging- even at the code level, the standard already provides a nice output object already: ostream. If you're concerned about the performance of logging in release mode, you might be logging too much, or just thinking about things in the wrong way.
  3. Thread safety. Out of curiosity, why does your event queue need to be static?
  4. boost format problem

    Defining _SCL_SECURE_NO_DEPRECATE (_SCL_SECURE_NO_WARNINGS in VC9) and _CRT_SECURE_NO_DEPRECATE in your project settings, or somewhere sufficiently early in the code, should also do the trick.
  5. http://parashift.com/c++-faq-lite/how-to-learn-cpp.html the c++-faq-lite also points to: Correct C++ tutorial.
  6. simple class question

    Inheritance implies an "is-a" relationship. In your example, your region "is-a" 'outdoor', and "is-a" 'inside'. Without seeing any other code, it sounds like you have a class inheriting contradictory properties. I recommend checking out this link, http://parashift.com/c++-faq-lite/basics-of-inheritance.html
  7. efficient sorting

    If the precedence of the struct's members is static, as others have pointed out, std::sort with a comparison functor is the way to go. If you need the precedence to be dynamic at runtime, you need something like (shameless plug) this. The latter method is much more complicated, so only use it if you really need that flexibility.
  8. I was reading this article on Mozilla's memory fragmentation problem a while back. Some of the comments there might lead you in the right direction.
  9. The 'AdapterRAM' member of the WMI Win32_VideoController table will tell you how much ram a video card has.
  10. If you don't care about portability, you could use Window's WMI facility. It's a little complicated, but you can get a wealth of information this way. For information about the video card, try the 'Win32_VideoController' table. This project* has an example of taking a WMI table, and stuffing it into a std::map. Pretty handy. *This is not my code, so I make no presumptions about correctness or licensing.
  11. Quote:Original post by ApochPiQ ... The main problem that's been cropping up is the presence of statically constructed objects - specifically, these objects aren't destructed until after main() exits ... Are they destructed before or after atexit's mechanism is triggered?
  12. If you're worried about really fast moving objects missing a collision over a time step, why not test the collision of extruded objects? When testing for collision between objects A, and B let As be A at the start of the frame let Ad be A at the intended destination (given that moving from As to Ad doesn't collide with anything) let A' be the volume that A passes through from As to Ad (assume you've constructed something similar for B') Test for collision between A' and B'.
  13. I believe Dave Eberly's book on game engine design has a templated math library.
  14. (Almost) recursive typedef

    Quote:Original post by ToohrVyk Quote:Original post by godecho Again, you're trying to use types (Node2 in the first typedef) before they've been defined. This doesn't work on any compilers I have on hand, and I can't see how it'd be standard C++, let alone portable. It's allowed, and portable, to use types before they are defined—this is precisely the point of forward declarations. The real question here is whether an instantiation of a standard library container (or any other class template) can be forward-declared as class, and I don't know the answer. Allow me to amend my previous statement: You can't use a type before it's declared. edit: I missed his forward declaration in his second example oops, :blush: