Re: gfortran and the family of fortran array types



Jugoslav Dujic <jdujic@xxxxxxxxx> wrote:

With F2003 C interop, C_LOC does that conversion explicitly and is
guaranteed to be portable. Before that, one would just pass the array
(assumed-size assumed by compiler), relying on both compilers to do
the right thing (they would most often do, but it wasn't guaranteed
by the Standard).

Just to clarify (I hope)... withF2003 BIND(C) on an appropriate
interface the result is guaranteed to be portable. One could misread the
above as implying that C_LOC is needed for a guarantee of portability.
It isn't. In fact, it is the BIND(C) that gives you the portability
guarantee - not the C_LOC. Without the BIND(C), the C_LOC stuff wouldn't
be portable... and indeed, as Glen notes, would likely not work without
extra hacks; you'll end up passing the C_LOC result by reference.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.



Relevant Pages

  • Re: variable length array
    ... a bad habit I got from using a bad compiler that gave ... or the malloc "almost equivalent" ... Does it guarantee that memory is zeroed? ... For guaranteed portability, you need ...
    (comp.lang.c)
  • Re: variable length array
    ... a bad habit I got from using a bad compiler that gave ... or the malloc "almost equivalent" ... Does it guarantee that memory is zeroed? ... For guaranteed portability, you need ...
    (comp.lang.c)
  • Re: C99 exact width integers usage - informal survey
    ... ANSI compliant compilers guarantee minimum sizes for char, int, and ... yes and no on the portability issue. ... types int and unsigned int. ... and no shorter than an 'int' on the same compiler. ...
    (comp.arch.embedded)
  • Re: Overwriting Allocated Memory from malloc()
    ... >> for portability. ... >> Because 'buffer' was intentionally not initialized, there is no guarantee ... > Which is why I did not initialize it. ... I wanted buffer to contain ...
    (comp.lang.c)
  • Re: Back in the desert!
    ... More than 2 users will overload it. ... I notice they advertise high speed but won't guarantee it. ... The main reason I like mine is portability. ... BILL P. ...
    (rec.outdoors.rv-travel)