Re: Several questions about character C binding
- From: Steven Correll <steven.correll@xxxxxxxxx>
- Date: Sat, 19 Jan 2008 18:52:02 -0800 (PST)
"Steven Correll" <steven.corr...@xxxxxxxxx> wrote in message
news:8a63aa03-cec1-45b2-8fd8-
d3862837ed29@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The number of Fortran "dummy arguments" must match the number of C
"formal parameters", but a Fortran dummy argument may correspond to
zero, one, or many ABI "arguments."
On Jan 18, 4:18 pm, "James Van Buskirk" <not_va...@xxxxxxxxxxx> wrote:
I just can't believe you made this comment. Do you think there is
some kind of bug in the standard due to which after the whole of
chpater 15 (on C interop) as well as the extra effort made in sections
12.4.1.2 and 12.4.1.5 to allow interoperability of character scalars
with C strings it just doesn't work? If so, you should inform the
committee so that they can fix it.
I don't see any bug in the standard. To repeat: The rule you cited
from 15.2.6 says that the number of Fortran "dummy arguments" and the
number of C "formal parameters" (each term has a precise definition in
its respective standard) must be the same: that's a restriction on the
programmer. It does not say that the number of machine-level arguments
must also be the same (which would be a restriction on the
implementation.)
If a Fortran compiler claims to be interoperable with a C compiler
while using STDCALL, and it executes a conforming program incorrectly
due to extra machine-level arguments, then the compiler fails to
conform to the standard: not because of the rule in 15.2.6, but
because it executes the program incorrectly. On Linux (for example)
where extra arguments are harmless, the compiler is free to pass them.
You may reasonably say that a Windows Fortran compiler isn't useful to
you unless it supports STDCALL calls to Windows OS functions, but you
can't say it violates the standard. As a thought experiment, imagine
an interoperable Fortran interpreter and C interpreter which both work
by emitting code for a Java-like virtual machine, rather than machine
language. Imagine that the C interpreter conforms to the C standard,
providing all the C library functions, but not the Windows OS
functions (the C standard doesn't require them.) It's difficult to
believe that the Fortran standard could, under the rubric of
interoperability, compel the Fortran processor to do something which
the C processor itself is not required to do.
.
- Follow-Ups:
- Re: Several questions about character C binding
- From: James Van Buskirk
- Re: Several questions about character C binding
- References:
- Several questions about character C binding
- From: fj
- Re: Several questions about character C binding
- From: James Van Buskirk
- Re: Several questions about character C binding
- From: Steven Correll
- Re: Several questions about character C binding
- From: James Van Buskirk
- Several questions about character C binding
- Prev by Date: Re: Several questions about character C binding
- Next by Date: Re: What is wrong with this search for the character PV/PQ
- Previous by thread: Re: Several questions about character C binding
- Next by thread: Re: Several questions about character C binding
- Index(es):
Relevant Pages
|