Strange machine-level exception
- Posted by Juergen Luethje <j.lue at gmx.de> Jun 17, 2007
- 652 views
Hi all, I've changed my private create_set() function a little, in order to take advantage of find_from(). Then I encountered a strange machine-level exception. I've tested it on Windows XP Pro and Euphoria 3.1. The following code runs fine when interpreted by EX.exe, EXW.exe and EXWC.exe. When I uncomment the denoted line near the end, the program still runs fine with EX.exe but crashes reliably with EXW.exe and EXWC.exe. Renaming "safe.e" to "machine.e" and including it in the program didn't provide any hints.
function create_set (sequence s) -- create a set (= remove duplicate entries) integer p if length(s) < 2 then return s end if p = length(s) for i = length(s)-1 to 1 by -1 do if find_from(s[i], s, i+1) = 0 then -- Machine-level exception here ... p -= 1 s[p] = s[i] end if end for return s[p..$] end function sequence freq, result, unique integer n, player n = 1000 result = {} for i = 1 to n do freq = repeat(0, 3) for card = 1 to 4 do player = rand(3) -- freq[player] += 1 -- ... after uncommenting this line! end for result = append(result, freq) end for unique = create_set(result) ? unique if getc(0) then end if
Can someone please confirm the problem? Regards, Juergen