Runs in Debug but not in Release
BlitzMax Forums/BlitzMax Beginners Area/Runs in Debug but not in Release
| ||
Does anyone know what could cause a program to run perfectly well in debug mode but not in Release mode. |
| ||
What happens in release mode? |
| ||
Well... It's hard to say really... The program executes, the screen goes blank and I can't get out of the program. So I have to reboot. In debug mode...It runs as expected. |
| ||
Try rebuilding all your modules to ensure the release versions are up to date. |
| ||
I did that and nothing changed. I usually use debug mode.. My program is getting faily long now, andI have no Idea what the difference is between debug and release, besides the obvious. |
| ||
In windowed, or full-screen mode? (If fullscreen, try switching to windowed mode and see if the screen remains blank) |
| ||
try changing to superstrict that could help |
| ||
OK I will try windowed mode when I get home tonight, The program is in full screen. Now if it works in windowed mode what then? I have updated all of my drivers. Chris, Since the advent of Super Strict I always us it. |
| ||
LOL - good init! do let us know if you find the problem! |
| ||
Well, nothing I have tried works... I guess I am going to have to remove lines of code (ugg!) in order to find out what is causing this problem. I've tried this on both of my computers and both show a blank screen in release mode. Debug is perfectly fine. Eric |
| ||
You can Print to the console to try and locate where it goes wrong. Also, might be worth trying the GL driver (if you are on Windows). |
| ||
I had a similar problem using a C library (as it turned out it was an uninitialised variable in the C part To trace it ended up putting print "1" print "2" etc at many point in the program! you many also want to print out any variables to see if they have sane values are you using any external libs? |
| ||
I Isolated is to this.Method Closest:TObject(Item:TCollection) Local TestRange:Float=10000 Local Range:Float Local Swap:Byte Repeat Swap=False For Local Index:TObject=EachIn Item:TCollection Range=Position.DistanceTo(Index.Position) If Range<TestRange TestRange=Range Attack=Index Swap=True End If 'Print "Range "+Range Next Until Swap=False Or KeyHit(Key_Escape) Return Attack End Method In debug it runs great. Now if I am in Release mode, and I uncomment the 'Print "Range "+Range" ' Line It runs.. it's very jumpy because of the statement. But why would this one line change the program. |
| ||
Thats an interesting problem and I think I know what's happening and can probably reproduce it. In the meantime, does "If Range*1.0001<TestRange" fix it? |
| ||
Yes that worked...What is causing that? Thanks...Can this be fixed in a normal Module Sync? |
| ||
I have a vague notion of what's happening. The problem is that you can't control the precision used for calculations. A float (32-bit) is actually 64-bit or 80-bit when held in a register. The value drops back to 32-bit when stored in memory. Debug and Release differ in this register handling. And Printing a value can force it to be temporarily stored in memory, thus changing the precision. I don't know exactly what's happening in your program, but this is probably the underlying cause of the trouble. |
| ||
Skidracer, Is there going to be a fix for this? Eric |
| ||
Possibly use Double instead of float? |
| ||
Nope that did not work...Good thought though. :) |
| ||
a little more concise:Function mynumber##() Return Sqr(2.0) End Function Local a#=mynumber() If a>mynumber() Print "no @#!*ing way" End changing the function to return a float interestingly fixes it so not sure there is any problem here... |
| ||
But it still doesn't fix my problem. I changed all Floats to doubles. Range=Position.DistanceTo(Index.Position) The Method .DistanceTo Returns A double. And my above sample works when I use your original suggestion. But I can't get it to work otherwise. |
| ||
It's certainly kept Mark quiet for the last 30 minutes... |
| ||
:) |