[nicl] RFR: Undefined struct and void*
Henry Jen
henry.jen at oracle.com
Thu May 24 18:00:52 UTC 2018
On May 24, 2018, at 8:47 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
>
>
>
> On 24/05/18 16:10, Henry Jen wrote:
>> I understand the perspective of Pointer, but it’s really not that different to a incomplete array, the descriptor currently generated is '*c’. The benefit of the new approach is that the type safety is better as the struct type is preserved and enforced.
> I disagree. If you have an incomplete array, you do have layout info (of the element type) you just don't know how many elements there are. So you can take the field that is of an incomplete array type and do pointer arithmetic on it, no problems.
>
> In the case of undefined structs, all this is not true; there's no layout for that (as the compiler has seen no definition), so doing an increment on a pointer to an undef struct has no meaning.
>
This is true. But the native layout can be separated from carrier type. That is, we can use ‘V’ as type descriptor instead of ‘*c’ for undefined struct, that will make Pointer arithmetic works just like Pointer<Void>.
I think we need more bake time for this, I’ll separate out undefined struct changes.
Cheers,
Henry
More information about the panama-dev
mailing list