min/max and string arguments

Daniel Franke franke.daniel@gmail.com
Thu Jan 1 19:30:00 GMT 2009


Happy new year, everyone!


Let's start this year with a small puzzle :)

What should be the proper output of this code fragment?

	print *, MIN ("foo", "", "bar")
	end

gfortran answers "bar" while an equivalent C-fragment using strcmp() would 
result in "". gfortran's behavior becomes especially interesting with:

	min("", " ")   ->   " "
	max("", " ")   ->   " "

while one would probably expect "" and " " respectively?!

How do other compilers handle this? Intel 10.1, the only other one I have 
access to, does not accept string arguments.

Thanks!

	Daniel



More information about the Fortran mailing list