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: 750 Reporter: administrator Status: closed Resolution: fixed Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
(* char: print a character given it's character number *)
let error format =
Printf.fprintf stderr format
;;
let print_char c =
Printf.printf "hallo\n" ;
Printf.printf "%c\n" (char_of_int c)
;;
if Array.length Sys.argv < 2 then
error "Usage: char value\n"
else
try
let
value = int_of_string Sys.argv.(1)
in
print_char value
with Failure x ->
error "Usage: char value\n"
;;
On Sun, Dec 23, 2001 at 10:24:27PM +0100, jankr@ifi.uio.no wrote:
I have the following code as char.ml:
I think that ocamlopt does not like that you name your files like the
modules of the OCaml standard library. The results are sometimes
surprising: if you name your file "string.ml" or "array.ml", for
example...
I have the following code as char.ml:
...and then, on the command line:
$ ocamlopt -o char char.ml
./char 65
Segmentation fault
Daniel's explanation is correct: your module Char conflicts with the
module Char from the standard library, which is referenced indirectly
through Printf and then String. Still, ocamlopt should fail with an
error at link-time rather than generate incorrect code! I'm working
on a fix. Thanks for the bug report.
Original bug ID: 750
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Jan Kroken
Version: ocaml-3.04
OS: linux-2.4.10-ac7 glibc-2.2.2 gcc-3.0.2
Submission from: krs-dhcp323.studby.uio.no (129.240.107.100)
I have the following code as char.ml:
(* char: print a character given it's character number *)
let error format =
Printf.fprintf stderr format
;;
let print_char c =
Printf.printf "hallo\n" ;
Printf.printf "%c\n" (char_of_int c)
;;
if Array.length Sys.argv < 2 then
error "Usage: char value\n"
else
try
let
value = int_of_string Sys.argv.(1)
in
print_char value
with Failure x ->
error "Usage: char value\n"
;;
...and then, on the command line:
$ ocaml char.ml 65
hallo
A
$ ocamlopt -o char char.ml
./char 65
Segmentation fault
The text was updated successfully, but these errors were encountered: