(j3.2006) BIND(C, name='') means no binding label?
Bill Long
longb
Wed Jul 25 11:46:02 EDT 2007
Jim Xia wrote:
>
> Hi everyone,
>
> This is a issue raised by Rob James before he left IBM, so I brought
> it here to see if this topic was discussed within J3 members.
> Consider the following declaration
> INTEGER(C_INT), BIND(C, name = ' ') :: foo
>
> The question is: does this declaration conform to F2003 standard?
>
> Here is what subclause 15.3.1 [403:4-9] says
>
> If a variable or common block has the BIND attribute with the NAME=
> specifier and the value of its
> expression, after discarding leading and trailing blanks, *has
> nonzero length*, the variable or common
> block has this as its binding label. The case of letters in the
> binding label is significant. If a variable
> or common block has the BIND attribute specified without a NAME=
> specifier, the binding label is the
> same as the name of the entity using lower case letters. Otherwise,
> the variable of common block has
> no binding label.
Note: In the sentence above "of" should have been "or". Malcolm appears
to have fixed this in the current f08 draft.
>
> Based on this paragraph, the previous declaration of FOO does not have
> a binding label. What does that mean? Does it mean it behaves just
> as if the following declaration: INTEGER(C_INT) :: foo,
Yes, essentially that. There is no binding label when name=" " is
specified. In the case of a variable, the BIND clause serves two
purposes - to establish an external name (binding label) or that there
is none, and to make sure that the type and type parameters are valid
for interop. For simple scalars like this example the second doesn't do
much other than trigger a compiler check. On the other hand, for
procedures, a BIND clause might trigger an alternate argument passing
convention. You might need the calling convention capability but do not
want an external name, as when the procedure is referenced through a
procedure pointer. The name=" " option is there mainly for that case,
and included in the variable case for consistency.
Cheers,
Bill
> or this is a declaration the same as if no name= specifier is
> supplied: INTEGER(C_INT), BIND(C) :: foo
>
> Thanks,
>
> Jim Xia
>
> XL Fortran Compiler Testing
> IBM Toronto Lab at 8200 Warden Ave.
> Phone (905) 413-3444 Tie-line 969-3444
> D2/NAH/8200 /MKM
> ------------------------------------------------------------------------
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>
--
Bill Long longb at cray.com
Fortran Technical Support & voice: 651-605-9024
Bioinformatics Software Development fax: 651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20070725/32841456/attachment-0001.html
More information about the J3
mailing list