- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If for instance, the items are integers, they should match up by KIND.
If we put a LITERAL in the calling sequence, how does the compiler match them up then?
Example:
Call SUB1 (3)
subroutine SUB1 (int1)
integer (kind=4) int1
end subroutine
The compiler should set it up with a 4 byte literal.
But how would it know?
I guess one could use an explicit interface to get around this problem.
If we put a LITERAL in the calling sequence, how does the compiler match them up then?
Example:
Call SUB1 (3)
subroutine SUB1 (int1)
integer (kind=4) int1
end subroutine
The compiler should set it up with a 4 byte literal.
But how would it know?
I guess one could use an explicit interface to get around this problem.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The literal 3 is, by definition, of "default integer" type and kind, which is typically integer(4). The standard requires that the type and kind match that of the corresponding dummy argument.
Lacking an explicit interface, the compiler has no information to go on and assumes you did it right. If there IS an explicit interface, or generated interface checking is in use, the compiler can complain if the types and kinds do not match. We do have an extension, however, that if it is simply a difference in kind for a literal actual argument, we silently convert to the required kind. If you turn on standards checking, you'll get a warning about that.
If you need to specify a different kind, you do that with a kind suffix, for example, 3_2 or 3_K_SMALLINT where K_SMALLINT is a PARAMETER constant you have defined to be 2 (or whatever).
Lacking an explicit interface, the compiler has no information to go on and assumes you did it right. If there IS an explicit interface, or generated interface checking is in use, the compiler can complain if the types and kinds do not match. We do have an extension, however, that if it is simply a difference in kind for a literal actual argument, we silently convert to the required kind. If you turn on standards checking, you'll get a warning about that.
If you need to specify a different kind, you do that with a kind suffix, for example, 3_2 or 3_K_SMALLINT where K_SMALLINT is a PARAMETER constant you have defined to be 2 (or whatever).
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page