Re: Proper way to return a string
- From: nospam@xxxxxxxxxxxxx (Richard E Maine)
- Date: Thu, 28 Dec 2006 08:53:27 -0800
Terence <tbwright@xxxxxxxxx> wrote:
For any string operation I always use a function call because this can
return an error code,
I've noticed that I usually disagree with almost every style preference
Terence expresses. If there is an exact opposite of his preference,
you'll usually be right in guessing that opposite to be my preference.
It applies here.
For me, returning an error code is a reason to avoid using a function.
I strive to make my functions pure, at least in principle (i.e. I have
much f90 code where the functions aren't declared as pure, but do
otherwise meet the requirements for doing so), which means that I don't
tend to use a lot of functions. I do make some exceptions to purity, but
they are exceptions rather than the rule.
On the other hand, I do have several basic string functions because they
are things that are pure and do not have error codes. That includes such
things as case conversion, string comparison, and conversion of numeric
values to strings. (Yes, I know that the conversion can potentially
overflow fixed string lengths, but asterisk fill is ok for handling that
in my apps - any error handling for the asterisks can be separated).
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- Follow-Ups:
- Re: Proper way to return a string
- From: Terence
- Re: Proper way to return a string
- From: Paul van Delst
- Re: Proper way to return a string
- References:
- Proper way to return a string
- From: Jeremy
- Re: Proper way to return a string
- From: Steven G. Kargl
- Re: Proper way to return a string
- From: Gordon Sande
- Re: Proper way to return a string
- From: Steven G. Kargl
- Re: Proper way to return a string
- From: Terence
- Proper way to return a string
- Prev by Date: Re: Proper way to return a string
- Next by Date: Re: dummy argument assumed-size
- Previous by thread: Re: Proper way to return a string
- Next by thread: Re: Proper way to return a string
- Index(es):
Relevant Pages
|