[J3] Is BIND (C [ , NAME = scalar-default-char-constant-expr ]) where scalar-default-char-constant-expr has zero length legal?
Vipul Parekh
parekhvs at gmail.com
Wed Jan 9 11:26:37 EST 2019
On Tue, Jan 8, 2019 at 6:03 PM Bill Long via J3
<j3 at mailman.j3-fortran.org> wrote:
>
> ..
> > It seems option 1 is preferred, and I think it makes more sense too. The problem is I couldn't find any wording in the standard that makes it clear.
>
> 18.10.2 para 2.
>
Hi Daniel,
Yes, as indicated by Bill, paragraph 2 in section 18.10 appears to be
it in terms of wording in the standard.
Please excuse me here for being pedantic, but based on 18-007r1 doc
and the discussion here as well as elsewhere, I take 18.10.2 para 2 to
indicate that when NAME is specified with effectively zero length in
the BIND statement, the proc-lang-binding-spec specifications as
indicated in the standard e.g., section 18.3.6, constraints
C1552-C1559, etc. continue to apply. Accordingly, code such as
subroutine sub( arg ) bind(C, name="")
class(*) arg
end subroutine
must be diagnosed by the compiler as having an error due to a
non-interoperable dummy argument. Thankfully this error is detected
by two processors I tried.
On the other hand, I expect code such as
subroutine sub() bind(C, name="")
print *, "Hello World!"
end subroutine
to compile ok. It does with the 2 processors. In addition, the
program created using
interface
subroutine sub() bind(C, name="")
end subroutine
end interface
call sub()
end
should execute and produce the expected output; it does. It also
appears processor-dependent as to what the Fortran label is for
procedure sub. It's just 'sub' in one case and '_sub_' in the other
and this seems to make sense too.
Please let me know if I got something wrong.
Regards,
Vipul
More information about the J3
mailing list