Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.
You could write a specification function that computes the length of the function result. Sometimes this isn't feasible, though, for example when the function returns the next line of input. In this case the function result may be declared as allocatable length. In either case the interface must be explicit in the calling program unit.
function foo()
character(:), allocatable :: foo
foo = "abc"
end function foo
You must have an explicit interface for this visible to the caller - the easiest way to do that is to put the function in a module and then USE the module in the program units where you want to call the function.
Please note also that you need a reasonably current compiler (12.1 minimum, I think), for this to work.