[J3] sequence type equality
Robert Corbett
rpcorbett at att.net
Wed Oct 14 16:07:26 EDT 2020
Vipul and Malcolm questioned whether variables thathave sequence types that differ only in thatcomponents have different default initializationsshould be considered to have the same type. Theprogram given below cannot answer that question,but it can test whether a compiler does considerthem the same or different. If the program compileswithout reporting any type mismatches, it does nottake differing default initializations into accountwhen determining whether variables of sequence typehave the same type.
I do not currently have access to a compiler, soplease excuse any errors in the program.
Robert Corbett
------------------------------------------------------------
MODULE TYPE0
TYPE T
SEQUENCE
INTEGER :: I
END TYPE T
END
MODULE TYPE1
TYPE T
SEQUENCE
INTEGER :: I
END TYPE T
END
MODULE TYPE2
TYPE T
SEQUENCE
INTEGER :: I = 2
END TYPE T
END
MODULE TYPE3
TYPE T
SEQUENCE
INTEGER :: I = 3
END TYPE T
END
PROGRAM MAIN
USE TYPE0, T0 => T
USE TYPE1, T1 => T
USE TYPE2, T2 => T
USE TYPE3, T3 => T
TYPE(T0) V0
TYPE(T1) V1
TYPE(T2) V2
TYPE(T3) V3
V0%I = 0
V1%I = 1
V0 = v1
PRINT *, V0%I
V0 = V2
PRINT, *, V0%I
V2 = V3
PRINT *, V2%I
END
T
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20201014/7547988c/attachment.htm>
More information about the J3
mailing list