Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature wish: uninitialized unboxed arrays #2369

Closed
vicuna opened this issue Feb 14, 2000 · 2 comments
Closed

feature wish: uninitialized unboxed arrays #2369

vicuna opened this issue Feb 14, 2000 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Feb 14, 2000

Original bug ID: 37
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Markus Mottl
Version: 2.99
OS:
Submission from: ballater.dai.ed.ac.uk (129.215.25.79)

Hello,

would it be easily possible to provide for functions in the
"Array"-module which allocate unboxed integer- and float-arrays
without initializing them (similar to "String.create")?

This would allow twice as fast reallocations when implementing
resizable arrays for such data types.

Because this might lead to illegal representations of the numbers,
these functions should probably be in the "unsafe" part.

Best regards,
Markus Mottl

@vicuna
Copy link
Author

vicuna commented Feb 15, 2000

Comment author: administrator

would it be easily possible to provide for functions in the
"Array"-module which allocate unboxed integer- and float-arrays
without initializing them (similar to "String.create")?

For float arrays, this would be no problem. For int arrays, it's
harder, because those uninitialized int arrays should be tagged
specially so as to prevent the GC from scanning them for pointers.
This special tagging (e.g. as Abstract_tag) would cause generic
polymorphic functions such as equality, hashing and output_value to
produce wrong results.

Because this might lead to illegal representations of the numbers,
these functions should probably be in the "unsafe" part.

Reading from an uninitialized float arrays could certainly return NaNs
("not a number"). The so-called "quiet" NaNs cause no problem, they
just propagate through all floating-point operations. But there might
be some problems with "signalling" NaNs (if the processor implements
them).

Best regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Mar 26, 2000

Comment author: administrator

The new Bigarray module partially answers this wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant