[nicl] RFR: Undefined struct and void*
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu May 24 15:47:30 UTC 2018
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.
Maurizio
More information about the panama-dev
mailing list