| Richard E Maine 2004-12-15, 3:59 pm |
| Rich Townsend <rhdt@barVOIDtol.udel.edu> writes:
[code elided]
> Now, both compilers I've tried this on compile and run without error
> (Lahey and Intel). Assuming such behaviour is *correct*, this means
> that -- so long as one knows its definition -- a derived type with
> private components can be p ed into. Presumably, these components
> can be poked as well. Wow -- the gates to a whole new continent of
> cruft have just opened before me!
"Correct" isn't the right term here. Such behavior is allowed.
It is not guaranteed. Derived types don't *HAVE* to be laid out
with internal structure the qay you might expect... and sometimes
they aren't. Your odds are probably good in the particular case
you showed, but it is by no means guaranteed by the standard.
Yes, TRANSFER is one of the tools to use when you want to
hack like that. But, in addition my comment about dragons, I
might summarize it by saying that if you have to ask, then you
probably shouldn't be doing it. :-(
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
|