slightly OT: nullifying an array of pointers
Daniel Franke
franke.daniel@gmail.com
Thu Jul 6 20:29:00 GMT 2006
> What on earth are you talking about?
TYPE :: int_holder
INTEGER :: i
END TYPE
TYPE(int_holder), DIMENSION(n) :: array
array%i = intnull() ! valid, intnull() a function that returns 0
array = int_holder(0) ! valid
!----------
TYPE :: intptr_holder
INTEGER, POINTER :: i
END TYPE
TYPE(intptr_holder), DIMENSION(n) :: array
array%i = null() ! invalid <--
array = intptr_holder(null()) ! valid
The pointers do not do as the ints do. For someone fluent in fortran this is
obvious. For someone who coded C(++) for years this deviating behaviour
(although standard conforming) is ... strange. I spent two, maybe three hours
this morning trying to figure out what the hell the compiler(s) kept
complaining about. As quoted by you, this behaviour is described in the
standard. That's fine for those who have the standards readily available - I
do not.
Let's close this discussion, it is off topic and I will avoid this particular
trap in the future. Thanks nevertheless.
Regards
Daniel
More information about the Fortran
mailing list