[Users] [ET Trac] [Einstein Toolkit] #1378: provide equivalent of fprintf(stderr, "%s\n", msg) in Fortran

Peter Diener diener at cct.lsu.edu
Mon May 19 13:47:46 CDT 2014


I didn't get this in before the ticket was closed but thought the 
following might be useful.

I believe most compilers (if not all) use unit 0 as stderr, but this is 
not guaranteed by the standard. However, a fortran 2003 compliant compiler 
provides an intrinsic module 'iso_fortran_env' that contains this 
information in the constant error_unit. It also provides input_unit 
(stdin) and output_unit (stdout). So for fortran 2003 (and later) 
compliant compilers, the portable way to write to stderr is to use the 
information in this module.

Cheers,

   Peter

On Mon, 19 May 2014, Einstein Toolkit wrote:

> #1378: provide equivalent of fprintf(stderr, "%s\n", msg) in Fortran
> --------------------------+-------------------------------------------------
>  Reporter:  rhaas        |       Owner:
>      Type:  enhancement  |      Status:  closed
>  Priority:  minor        |   Milestone:
> Component:  Cactus       |     Version:  development version
> Resolution:  wontfix      |    Keywords:
> --------------------------+-------------------------------------------------
> Changes (by rhaas):
>
>  * status:  new => closed
>  * resolution:  => wontfix
>
>
> Comment:
>
> Ah, I did not now about unit 0 for stderr. Cactus redirects file
> descriptor 0 (Unix parlance, stdout) to /dev/null on the non-root
> processes, so writing to unit 6 (or *) did not work.
>
> -- 
> Ticket URL: <https://trac.einsteintoolkit.org/ticket/1378#comment:8>
> Einstein Toolkit <http://einsteintoolkit.org>
> The Einstein Toolkit
> _______________________________________________
> Trac mailing list
> Trac at einsteintoolkit.org
> http://lists.einsteintoolkit.org/mailman/listinfo/trac
>


More information about the Users mailing list