Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Array.init evaluates callback although it should not do so #6575
Original bug ID: 6575
Look at this (ocaml-4.02):
let n = 0 ;;
$ ocamlopt -o m m.ml
Same with ocamlc.
This is straight-forward from the definition of Array.init, but nevertheless quite surprising behavior, because all other stdlib functions check the arguments before calling anything back.
Comment author: @alainfrisch
Commit 15898 on 4.02, 15899 on trunk. I've added a check for size < 0 before calling Array.make. Notes: