Open HJarausch opened 3 years ago
please check whether you can minimize this without using generics
My programme was in error (I wished I got a sensible error message). If the programme is corrected to
proc FP[T](A: var openArray[T], myCmp : proc(x,y:T):int {.nimcall}): int =
1
proc FS[T](A: var openArray[T], myCmp : proc(x,y:T):int {.nimcall} = system.cmp[T]): int =
result= FP(A, myCmp)
const
N= 6
K= 3
var A :array[N,float]= [7.0,4,6,3,9,1]
func myCmp(x,y:float):int =
(if x==y : 0 elif x<y : -1 else: 1)
echo FS(A)
it compiles and runs just fine.
Even if it's a mistake in the code Nim should output an error instead of making invalid C code :)
nim -v