Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / Assigning string from function failing

Author
Message
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 26th Feb 2010 11:21 Edited at: 26th Feb 2010 11:22
In my latest project, I made a function that takes a color value (from the POINT command), and returns a string representing the color name. This caused my program to crash via the "DBP process has performed an illegal operation" window.

It turns out the problem is to do with assigning the returned string to a variable. I have replicated it, to an extent, in this code:



On my machine, it runs OK (unlike my game), but crashes when you hit ESCAPE to quit. I think it's a different symptom of the same problem.

If you uncomment the ReturnString() line, which doesn't have the assignment part of it, and comment out the one above, it doesn't crash on exit.

-Newest DBP Upgrade
-Windows 7 64Bit (Could be something to do with this perhaps?)

I'm sure I've returned strings from functions before without an issue on previous upgrades and Windows XP, but it's failing now on the latest with Win7 64bit.

Radical hamsters skipping furiously into the blue ether, questioning their very existence while breathing out the bitter fog of smoked haddock.
Peter Parker
15
Years of Service
User Offline
Joined: 17th Apr 2009
Location:
Posted: 26th Feb 2010 12:30
The Help File says
Quote: "ENDFUNCTION variable"

So I think you have to program it that way

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 26th Feb 2010 13:44 Edited at: 26th Feb 2010 16:57
A similar bug has been reported before, but it was never fixed. I think it's due to using a string literal directly with endfunction, as using a variable fixes the problem:



[edit] Wait it wasn't a similar bug, this is the aforementioned bug. I heard Lee doesn't like touching the compiler so we may not see a fix for this.

Quote: "So I think you have to program it that way"


You don't have to, it's just a bug they haven't fixed. There are no problems on XP.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 26th Feb 2010 14:45
Ok, fair enough. So long as I have a work around, then I'll go with that.

Thanks chaps.

Radical hamsters skipping furiously into the blue ether, questioning their very existence while breathing out the bitter fog of smoked haddock.

Login to post a reply

Server time is: 2024-05-02 00:16:41
Your offset time is: 2024-05-02 00:16:41