[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
Tue Jan 8 11:06:13 EST 2019


Consider the following code example:

module example

  abstract interface
    subroutine sighandler_t(signum) bind(c)
      integer, value :: signum
    end subroutine
  end interface

contains

  subroutine foo
    call bar(sighandler)
  end subroutine

  subroutine bar(proc)
    procedure(sighandler_t) :: proc
  end subroutine

  subroutine sighandler(signum) bind(c,name='') ! NAME has zero length
    integer, value :: signum
    print *, signum
  end subroutine sighandler

end module

At 8.5.5, the standard says

R808 language-binding-spec is BIND (C [ , NAME = scalar-
default-char-constant-expr ])
...
"If the value of the scalar-default-char-constant-expr after discarding
leading and trailing blanks has nonzero
length, it shall be valid as an identifier on the companion processor."

But the standard doesn't specify what if the scalar-
default-char-constant-exprhas zero length.

Question: Should it be treated
1. as if the NAME specified is not specified or
2. the compiler should ignore the BIND attribute all together?

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20190108/60182e77/attachment-0001.html>


More information about the J3 mailing list