[J3] Is BIND (C [ , NAME = scalar-default-char-constant-expr ]) where scalar-default-char-constant-expr has zero length legal?

Daniel C Chen cdchen at ca.ibm.com
Wed Jan 9 11:38:51 EST 2019


Hi Vipul,

You are right. Since the standard specifies only the binding label is
omitted (i.e. the BIND attribute is preserved), all 3 cases you listed are
correct.

Thanks,

Daniel

XL Fortran Development, Fortran Standard Representative
IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com
http://www.ibm.com/software/awdtools/fortran/xlfortran



From:	Vipul Parekh via J3 <j3 at mailman.j3-fortran.org>
To:	General J3 interest list <j3 at mailman.j3-fortran.org>
Cc:	Vipul Parekh <parekhvs at gmail.com>
Date:	01/09/2019 11:26 AM
Subject:	Re: [J3] Is BIND (C [ , NAME =
            scalar-default-char-constant-expr ]) where
            scalar-default-char-constant-expr has zero length legal?
Sent by:	"J3" <j3-bounces at mailman.j3-fortran.org>



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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190109/312b8d0d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190109/312b8d0d/attachment.gif>


More information about the J3 mailing list