Re: defining an arbitrary type in your newer Fortrans



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Issue (1) below is covered by doing

REAL(kind=rk)

and exchanging the module defining rk. Well, as long as you
don't wish to change over to INTEGER, or COMPLEX ...


Regards


Ancient_Hacker wrote:
Jan Vorbrüggen wrote:
P.S. I dont consider "derived types" a good substitute.
Why not?

The textual edits, in C, that #define something for something else are a hack
to paste over C's inadequate type system. There is no need for such in
Fortran. Everything is nicely handled by derived types.

Jan

Jan, I'm no fan of C, but "typedef" is (slightly) more than a #define,
there is a little bit of compiler intelligence. Not much, but enough
to (barely) do the job.

I don't see anything directly comparable in Fortran.

maybe I miss something about derived types, but are they:

(1) NOT direct substitutes for built-in types. For example, it would
be nice to take a program sprinkled with "REAL" variable declarations,
and change some of the "REAL"s to "HighPrecisionFloatingType" and
others not so dainty to "UtilityFloatingType".

(2) derived types are really what we call structs or records, so you
cant have a simple scalar of that type without having to make up a
dummy member name that you have to keep repeating.

Maybe I'm missing something, but IMHO this is one of the first things
I'd want in Fortran, and no find it so far.

Just to confuse things some more, one CAN kludge it in a lot of
Fortrans that have a macro preprocessor option, but IMHO it's best to
avoid that if at all possible. Plus the preprocessor in CVF is mighty
smelly.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFFbHtMzwkB8vcRvCoRAnqjAKCBt3f0s0H7K29S7XfN8o684ot0gACeN4RK
VcArO+O+b/0jfclTZjPVPu4=
=MrpG
-----END PGP SIGNATURE-----
.



Relevant Pages

  • Re: defined operator & assignment speed & memory usage problem
    ... resolve into a single multiply-add, and have it appear in much longer ... all of the projects except mine abandoned Fortran ... programming I'm describing. ... My work involves creating derived types that are reusable for solving ...
    (comp.lang.fortran)
  • Re: It Hurts When I Do This
    ... In this single instance, Fortran has it wrong. ... It leads ... but not for derived types. ... simillar underlying meaning. ...
    (comp.lang.fortran)
  • Re: defining an arbitrary type in your newer Fortrans
    ... to paste over C's inadequate type system. ... Everything is nicely handled by derived types. ... I don't see anything directly comparable in Fortran. ... Fortrans that have a macro preprocessor option, ...
    (comp.lang.fortran)
  • Re: Subroutine arguments vs module variables
    ... > use derived types to aggregate related arguments into a single ... var = sum**2)/size ... This would be a major break from traditional Fortran and perhaps could ... Returning several function results is a convenient feature of Python, ...
    (comp.lang.fortran)