------- Comment #8 from fxcoudert at gcc dot gnu dot org 2007-11-08 23:51 ------- (In reply to comment #7) > However, most run time > libraries do the simple thing when they see io-redirection - they close the > stream file and re-open it as a ordinary file. Is there any reason GFORTRAN > could not do that ?
As a generic answer: I don't think it's advisable as it's against the principle of least surprise. I can think of at least a standard case where this could fail: you create a file, run a Fortran program with stdin redirected to that file, and unlink the file (so that, when the Fortran program exits, the file is removed without you having to wait and do it later). In that case, trying to reopen it will fail (it might even give wrong results if a new file of the same name is created, though it's not likely). This "unlink" trick is widely used. For example, my shell (zsh) does it to avoid you creating temporary files: instead of letting you do: $ ./foo > tmp $ ./bar < tmp you can do $ ./bar =(./foo) (and yes, you could use a pipe, but it's not the same if tmp is large and you don't want the two programs to run concurrently). Well, I really am verbose tonight, but I don't think it's desirable. -- fxcoudert at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33863