[MPI3 Fortran] Summary of items on the table
Lionel, Steve
steve.lionel at intel.com
Mon Apr 28 16:09:44 CDT 2008
Aleksandar Donev wrote:
> > My personal preference is for choice 4, the IGNORE attribute (the
> > specific spelling can be debated...
> > There seems to be strong sentiment with some
> > against such a thing, which I don't fully understand.
> Steve, I will throw this one back at you. I asked earlier, but never
> got a
> response:
>
> What happens if the dummy (with the IGNORE attribute) is declared as
> INTEGER(4), and things are performed inside that the standard defines
> only
> for 4-byte integers (e.g., some bit packing operation). Then, the
> routine is
> called with a REAL(8) array? What if the array is of a derived type of
> size 1
> byte?
It is the responsibility of the called routine to "do the right thing".
If one was writing a Fortran procedure with an IGNORE argument, it would
typically declare that argument to be an array of byte-sized integers,
or whatever makes sense for its implementation. In the actual called
routine, the IGNORE attribute would have no effect - whatever type the
argument was declared as is what it is.
> What specifically will Intel Fortran do? Compile and give results that
> make no
> sense? If so, the standard must have *specific* restrictions on what
> the
> actual is allowed to be, and what it means. Only illegal cases can be
> left
> without a meaning.
I don't agree with this. There don't need to be any restrictions. In
effect, it's like the common practice pre-F90 of deliberate argument
mismatches, such as "copy" routines. It's an often-used concept.
> If the routine is written in C and has a void* argument, I understand
> how it
> works. But I do not understand how it works if "everything is written
> in
> Fortran".
What can you do with a void* in C except assign an address to it? If
you want to manipulate the data, you have to cast to some real type,
such as char*. Same for Fortran.
There are many thousands of examples in "dusty deck" applications that
deliberately mismatch types. I see these almost every day from our
customers, who complain that the automatic interface checking we do
gives them errors they did not see before. An "IGNORE" attribute
provides a simple and well-defined mechanism for saying "trust me, I
know what I'm doing".
Would you feel better if the IGNORE attribute was allowed only in
interface bodies and not in procedures? Not that I am in favor of that
- I see no problem with giving Fortran coders access to this tool.
Steve
More information about the mpiwg-fortran
mailing list