Using optional arguments

Using optional arguments

Portrait de intelgg

I am getting compiler warning
"Routine PARSETAG called with different number and/or type of
actual arguments in earlier call - C attribute required if intended"
on a situation like the following:

integer function f(a, b, c, d) result(u)
integer a
integer b
integer c
integer, optional :: d
u = 0
end function f

integer function g() result(v)
integer, external :: f
v = f(1,2,3)
end function g

integer function h() result(w)
integer, external :: f
w = f(1,2,3,4)
end function h

The issue seems to be in the proper usage of optional arguments.
How do I resolve this?

3 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
Portrait de Steve Lionel (Intel)

If a routine has OPTIONAL arguments, an explicit interface must be visible to the caller.

Steve

Steve
Portrait de james@elementyl.com

Add a trailing comma on the call in g() so that your number of placeholders is consistent.

James

Connectez-vous pour laisser un commentaire.