Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Fish HF

classes reliableness

This topic is 5335 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m currently writing a game in c++, after writing it for a few months, the compiler(m$vcpp6) is starting to mess up my compiled thing. Theres a map class which stores the triangles and has some loading code, when in the function that loads the triangles from the file, the variables in that class are ok, but then when it calls other methods in that class, the variables in the class were screwed up(isnt what it should be) and when i set the function inlining on, it''s normal. I was thinking if it''s better to use a struct for the variables in the class, and make methods outside the class like quake do. Will that save me from those m$ cpp bugs? thanks

Share this post


Link to post
Share on other sites
Advertisement
Without knowing how the classes are defined, and what the calls that are messed up are, there''s no way we can know what''s wrong.
Changing to C instead of C++ isn''t an option, really

Share this post


Link to post
Share on other sites
I am not qualified to ansver your question, but I will attempt to help anyways. Try clearing the compile from the Compile->Clear menu and then recompile. I only say this because that is usualy what solves my problems when my programs react beyond all logic...

"On a long enough timeline the survival rate of everyone drops to zero"
- Fight Club

Share this post


Link to post
Share on other sites
Recompiling didn't help, it even happens in the debug configuration, and to solve it, i have to turn on function inlining, it seems to be a code generation bug, and even intel's c++ compiler has a problem with my game, it screws up my lighting calculation lol

[edited by - Fish HF on November 7, 2003 4:27:48 AM]

Share this post


Link to post
Share on other sites
Stop blaming the compiler and try to find your bugs instead. If your lighting calculations are screwed up, I'm quite certain that it has nothing to do with Intel C++.

[edited by - Dew_LED on November 7, 2003 4:37:35 AM]

Share this post


Link to post
Share on other sites
Often when variables end up changing for no apparent reason, it''s because you''ve written past the end of an array or you''re using a dangling pointer.

Share this post


Link to post
Share on other sites
i'm not blaming intel, it works on m$, except the map loading part fixed by setting function inlining on.
btw i wont post a new topic just because i got a problem that just annoyed me for a day, it affected my development progress for weeks.

[edited by - Fish HF on November 7, 2003 5:09:27 AM]

Share this post


Link to post
Share on other sites
[Continuing with my previous theory]... maybe function inlining causes the variables to be put on the stack in a different place where they don''t get clobbered, and it only appears to be working correctly.

Share this post


Link to post
Share on other sites
Many of these things are possibilities. Especially the one about potentially overwriting your data with an array overflow or wild pointer. Turn of code optimization and see if it runs as expected there, sometimes the compiler optimizes too agressively and breaks things. If that still fails, its most likely bugs in your code.

good luck.

Ravyne, NYN Interactive Entertainment
[My Site][My School][My Group]

Share this post


Link to post
Share on other sites
are there known bugs in vc++6 even with sp5 installed? i heard that the c++ compiler in .net is less buggy?
thanks

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!