If this is not the right place to ask for gnu pascal port to djgpp please let me know where can I do it... ---------------------------------------------------- Is this a bug in gnu pascal or just a "feature" I didn't know about? The code below is intented to find the prime numbers between 1 and 100 (... ok 1 isn't really a prime number but who cares? ;-)), but it doesn't work... it just displays 1.... Now if you add "h :=1;" just after "j" is initialized, then the program works!!!... it doesn't make sense, at least for me ... (it worked unmodified with the gpc dist from gpc112b.zip) btw: gnu pascal for djgpp from gpc20bb.zip, and bnu2951b.zip. This is the output from gpc --verbose Reading specs from c:\djgpp\lib\gcc-lib\djgpp\2.81\specs gpc version 19990503, based on gcc-2.8.1 ---------------------------------------------------- program prime (output); var p: array [0..49] of integer; h,i,j: integer; begin j := 0; for i := 1 to 100 do begin for h := 1 to j-1 do if 2*p[h]>i then h := j else if i mod p[h]= 0 then break; if h >= j then begin write(i,' '); p[j]:= i; inc(j) end end end.
participants (1)
-
Norberto Alfredo Bensa