Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: GL Check  (Read 2700 times)

0 Members and 1 Guest are viewing this topic.

ManualDev

  • Newbie
  • *
  • Posts: 4
    • View Profile
GL Check
« on: May 02, 2011, 07:20:26 pm »
Sometimes when I open .exe in debug-mode, I get following error:
http://oi51.tinypic.com/1zziz61.jpg
What can be a reason of this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
GL Check
« Reply #1 on: May 02, 2011, 08:39:50 pm »
The reason is most likely an error in your code ;)
Laurent Gomila - SFML developer

ManualDev

  • Newbie
  • *
  • Posts: 4
    • View Profile
GL Check
« Reply #2 on: May 02, 2011, 08:52:25 pm »
Okey, this can be in my code, but my question was about what can be reason of that? Cause this is happening only 1 for 5-6 times. If there is many possible reasons, please say that ; )

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
GL Check
« Reply #3 on: May 02, 2011, 09:09:38 pm »
Reasons can be dangling/uninitialized pointers that are dereferenced, invalid iterators, array out-of-bound access, ... just undefined behavior.

Generally these are all things of which a big part can be avoided when you follow some design rules and avoid low-level mechanisms. For example, use std::tr1::array or std::vector instead of raw arrays, don't manage memory manually (new and delete), don't use pointers when you can as well use objects, ensure object validity wherever possible, keep visibility and accessibility as local as possible.

There are also books like "Effective C++" that explain programming guidelines in detail.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: