Re: Strange machine-level exception
- Posted by Bernie Ryan <xotron at bluefrog.com> Jun 18, 2007
- 544 views
Juergen Luethje wrote: > > 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. > }}} <eucode> > 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 > </eucode> {{{ > Can someone please confirm the problem? > > Regards, > Juergen Juergen: Could the problem be caused by variations in the RAND() function ? The rand() may be compiled different for each compiler or different on each OS. The reason I say this is because the rand() occurs before the line that is commented out. Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan