[erlang-questions] Spurious '100' in array:new
Luke Bakken
luke@REDACTED
Mon Jan 28 16:40:50 CET 2019
I left an extra 10 in my explanation, it should have read:
In your case, the ?extend macro is evaluated and the result of
(NODESIZE * LEAFSIZE) is stored in the elements field of the record.
On Mon, Jan 28, 2019 at 7:36 AM Luke Bakken <luke@REDACTED> wrote:
>
> Hi Donald -
>
> I have never used the array data type, but I assume that the 100 is an
> internal implementation detail.
>
> https://github.com/erlang/otp/blob/OTP-21.2.4/lib/stdlib/src/array.erl#L151-L160
>
> Notice that the last element in the array record is for "elements",
> which are defined immediately above the record in the source code.
> non_neg_integer() can be the sole element in your array, and is
> determined by this code:
>
> https://github.com/erlang/otp/blob/OTP-21.2.4/lib/stdlib/src/array.erl#L286-L298
>
> In your case, the ?extend macro is evaluated and the result of 10 *
> (NODESIZE * LEAFSIZE) is stored in the elements field of the record.
>
> At least, I think this is the correct reading of this code :-)
> Thanks,
> Luke
More information about the erlang-questions
mailing list