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: 5235 Reporter: ecull78 Status: closed (set by @xavierleroy on 2011-06-04T14:40:52Z) Resolution: not a bug Priority: normal Severity: minor Version: 3.12.0 Category: ~DO NOT USE (was: OCaml general) Monitored by: "Pascal Cuoq" "Julien Signoles"
Bug description
Empty arrays, unlike empty lists, seem to be not physically equal if compiled in the native code:
Yes, ocamlc and ocamlopt treat zero-sized heap blocks differently. (Note that the empty list is not a block, hence the different behavior.) As Damien notes, the empty array is actually immutable, so == is not specified in this case.
Unifying the treatment of empty blocks between ocamlc and ocamlopt would be quite a bit of work without any clear benefits, so I'd rather stay with the status quo.
Original bug ID: 5235
Reporter: ecull78
Status: closed (set by @xavierleroy on 2011-06-04T14:40:52Z)
Resolution: not a bug
Priority: normal
Severity: minor
Version: 3.12.0
Category: ~DO NOT USE (was: OCaml general)
Monitored by: "Pascal Cuoq" "Julien Signoles"
Bug description
Empty arrays, unlike empty lists, seem to be not physically equal if compiled in the native code:
$ cat test.ml
print_endline (if [||] == [||] then "Equal!" else "Not equal!")
$ ocamlopt -o test.native test.ml
$ ./test.native
Not equal!
But when I check this in top level I have:
[||] == [||];;
and even this:
(Array.create 0 0) == [||];;
And using the bytecode compiler I have a similar result:
$ ocamlc -o test.byte test.ml
$ ./test.byte
Equal!
In comparison, empty lists are physically equal when using the native compiler:
$ cat test1.ml
print_endline (if [] == [] then "Equal!" else "Not equal!")
$ ocamlopt -o test1.native test1.ml
$ ./test1.native
Equal!
Additional information
tested under MacOSX 10.6.6 using a 32 bit version of ocaml compiled from sources according to the instructions
The text was updated successfully, but these errors were encountered: