From: Colin Watters on


"robin" <robin51(a)dodo.com.au> wrote in message
news:4bcf29d0$0$894$c30e37c6(a)exi-reader.telstra.net...
> "Colin Watters" <boss(a)qomputing.com> wrote in message
> news:hqm6l4$2kd$1(a)news.eternal-september.org...
> |
> | "robin" <robin51(a)dodo.com.au> wrote in message
> | news:4bce6070$0$895$c30e37c6(a)exi-reader.telstra.net...
> | > "Colin Watters" <boss(a)qomputing.com> wrote in message
> | > news:hqkvmd$t8d$1(a)news.eternal-september.org...
> | > |
> | > | "robin" <robin51(a)dodo.com.au> wrote in message
> | > | news:4bcdd1a5$0$893$c30e37c6(a)exi-reader.telstra.net...
> | > | > "Gib Bogle" <g.bogle(a)auckland.no.spam.ac.nz> wrote in message
> | > | > news:hqjgq0$iad$1(a)speranza.aioe.org...
> | > | > | Should one rely on allocated arrays being initialized to zero?
> | > | >
> | > | > Nothing is ever initialized to zero automatically.
> | >
> | > | Rubbish.
> | > |
> | > | See for example the compiler option "-zero" on Intel Fortran.
> | >
> | > Is that standard Fortran?
> |
> | Where does it say "standard Fortran" in "Nothing is ever initialized to
> | zero automatically"?
>
> Where does it say that everything is initialized to zero?
>
>
It doesn't. It shows an example of "something" being initialized to zero,
automatically.

Now answer MY question.

--
Qolin

Email: my qname at domain dot com
Domain: qomputing


From: Uno on
Tobias Burnus wrote:
> On 04/22/2010 08:46 AM, Uno wrote:
>> How would I set the real components of the living object to zero at the
>> gitgo?
>
> Use a default initializer:
>
>> type room
>> real :: hor
>
> append a " = 0.0". Then, you have:
>
> type room
> real :: hor = 0.0, vert = 0.0, subtract = 0.0
> character(len=10) :: name
> end type room
>
> (And of cause, any other constant expression is allowed, e.g.,
> "name='default'" or "hor=cos(42.0)")
>
>> type(room) :: living

! Define the basic tree type
type node
character(max_char) :: name ! name of node
real, pointer :: y(:) ! stored real data
type(node), pointer :: parent ! parent node
type(node), pointer :: sibling ! next sibling node
type(node), pointer :: child ! first child node
end type node

How do I extend this node to incorporate the above and thereafter give
them default values?

Until I understand the type definition better, I was thinking having a
unique integer in the node might be a good thing; otherwise isn't it

! Define the basic tree type
type node
character(20) :: name ! name of node
real, pointer :: hor(:) ! stored real data
real, pointer :: vert(:) ! stored real data
real, pointer :: subtract(:) ! stored real data
type(node), pointer :: parent ! parent node
type(node), pointer :: sibling ! next sibling node
type(node), pointer :: child ! first child node
end type node
?
--
Uno