You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 3430 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Bug description
hi,
i have a program to count lines. this works well, when compiled with ocamlopt
but it does not work on big files (more than 60000 lines) when compiled with
ocamlc.
program is:
########
let stream_fold_lines handler inival strm =
let rec reader res =
try reader (handler (input_line strm) res)
with | End_of_file -> res
in reader inival
let file_fold_lines handler inival filename =
try
let strm = open_in filename in
let res = stream_fold_lines handler inival strm in
close_in strm; res
with _ -> inival
Your program fails with `stack overflow' on big files when compiled
with ocamlc, and the corresponding exception is trapped with
" _ -> inival" in your file_fold_lines function.
hi,
i have a program to count lines. this works well, when compiled with ocamlopt
but it does not work on big files (more than 60000 lines) when compiled with
ocamlc.
program is:
########
let stream_fold_lines handler inival strm =
let rec reader res =
try reader (handler (input_line strm) res)
with | End_of_file -> res
in reader inival
let file_fold_lines handler inival filename =
try
let strm = open_in filename in
let res = stream_fold_lines handler inival strm in
close_in strm; res
with _ -> inival
Original bug ID: 3430
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
hi,
i have a program to count lines. this works well, when compiled with ocamlopt
but it does not work on big files (more than 60000 lines) when compiled with
ocamlc.
########
let stream_fold_lines handler inival strm =
let rec reader res =
try reader (handler (input_line strm) res)
with | End_of_file -> res
in reader inival
let file_fold_lines handler inival filename =
try
let strm = open_in filename in
let res = stream_fold_lines handler inival strm in
close_in strm; res
with _ -> inival
let count_lines fname = file_fold_lines (fun ln (_,cnt) -> (ln,cnt + 1))
("",1) fname
let main () = let fna = Sys.argv.(1) in let (ln,cnt) = count_lines fna in
Printf.printf "%s: lines %10d last <%s>\n" fna cnt ln
let _ = main ()
#################
m.becker
The text was updated successfully, but these errors were encountered: