How are unlimited polymorphic types implemented in Intel Fortran?
The obvious impolementation would be as two C poiinters, one pointing to a structure describing the target type and the other pointing to the target data.
It looks like gfortran uses this appproach: https://gcc.gnu.org/wiki/OOP#Internal_Representation
With this approach I would expect the following types to have the same storage size:
type class_ptr_type class(*), pointer :: ptr => null() end type class_ptr_type type class_cptr_type type(c_ptr) :: data_type = c_null_ptr type(c_ptr) :: data = c_null_ptr end type class_cptr_type
With Intel Fortran the types have storage sizes of 16 words and 2 words respectively.
With gfortran 4.9.2 the both have storage sizes of 2 words.
Does Intel Fortran include a structure describing the type in every type(class_ptr_type) object?
I can see that this may avoid one pointer dereference and may have better cache usage poperties but the 8x increase in storage seems a high price to pay.
The attached code illlustrates the use of these types.
Nick