Pointer ofNull method naming
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Nov 13 21:19:56 UTC 2019
On 13/11/2019 12:43, Ty Young wrote:
>
> On 11/13/19 2:28 AM, Maurizio Cimadamore wrote:
>> I'm ok with making the documentation more precise (I'm not sure I
>> like ofTyped()). Can you please clarify a bit what you mean by
>> 'filler' ? Like passing null ptr to a struct setter?
>
>
> Not struct types but more primitive native types like Pointer<Byte> or
> Pointer<Integer>.
>
>
> As an example, you have a function like this:
>
>
> int foo(Pointer<Pointer<Byte>> array, Pointer<Integer> size);
>
>
> But what you're actually interested in is at index 0 of the array, so
> "size" isn't needed and allocating a new Pointer would be a waste.
Not sure I follow - if you are interested in index 0, doesn't that mean
that the array would need to have at least _one_ element (e.g. size >= 1) ?
Maurizio
>
>
>>
>> (p.s. in these cases we have been also discussing bringing back
>> special treatment for Java null, so that null is re-interpreted to
>> Pointer.ofNull)
>
>
> I haven't gone too deep down the rabbit hole, but I see
> "LayoutTypeImpl.nullType" in BoundedPointer. Isn't that the null
> interpretation for a Pointer?
>
>
>
>>
>> Maurizio
>>
More information about the panama-dev
mailing list