Re: printing logical variables as "true" and "false"
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Mon, 28 Nov 2005 22:24:21 GMT
Richard E Maine wrote:
Heck, you don't need anything that fancy. A simpleRichard E Maine <nospam@xxxxxxxxxxxxx> wrote:
The implementation of my logical_thing might well have your merge incantation as its sole executable line.
Though on thinking slightly more on it, a more "interesting" version might be one that returned a "minimum-width" length instead of padding. Doing that is left as an exercise for the reader, the main part of the excercise being to make sure to stay within the standard's requirements for specification expressions. I haven't tried the exercise myself; shouldn't be too hard, but spec expressions are tricky enough that I wouldn't be confident of getting it right without pulling out the standard to check.
I suppose that in f2003 one could just make the function result an allocatable-length string, but that's too easy. :-) Sometimes I think that allocatable-length strings, which were almost an unintended but welcome side effect of other features, might turn out to be one of the most popular new things in f2003.
statement function gives a simple solution (that's probably
what you had in mind as an "exercise for the reader", right ;) ). Otherwise you could use a function like notation
and use the f2003 defined output stuff which avoids tricky
spec expressions and allocatable-length strings but lets you
do all kinds of fancy variable width output.
*** Hendrickson
PS: It's a pretty slow day here.
.
- Follow-Ups:
- Re: printing logical variables as "true" and "false"
- From: James Van Buskirk
- Re: printing logical variables as "true" and "false"
- References:
- printing logical variables as "true" and "false"
- From: beliavsky
- Re: printing logical variables as "true" and "false"
- From: Richard E Maine
- Re: printing logical variables as "true" and "false"
- From: *** Hendrickson
- Re: printing logical variables as "true" and "false"
- From: Richard E Maine
- Re: printing logical variables as "true" and "false"
- From: Richard E Maine
- printing logical variables as "true" and "false"
- Prev by Date: Re: printing logical variables as "true" and "false"
- Next by Date: Re: Compaq Visual Fortran discontinued: upgrade to Intel Visual Fortran?
- Previous by thread: Re: printing logical variables as "true" and "false"
- Next by thread: Re: printing logical variables as "true" and "false"
- Index(es):