Re: Passing Strings
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Fri, 17 Oct 2008 08:50:48 -0700
Richard Maine <nospam@xxxxxxxxxxxxx> wrote:
I'd say another way was to submit bug reports. Looks like a compiler bug
to me. I'm not sure what icc is that it would have a bug in common with
gfortran. I see nothing obviously wrong with the code.
Um. Ignore that. I obviously need to get my coffee before reading clf
instead of afterwards. See Herman's correct answer. I well know about
that particular bug (in user code, *NOT* in the compilers) and have
explained it to plenty of people, but my mind is obviously not yet in
gear this morning.
What you declare the dummy argument with a length of 255, that means
exactly 255, not anything up to 255. If you pass a shorter actual
argument, that is a user error. Most commonly, this will result in the
dummy argument using whatever garbage happens to be in the subsequent
memory locations after the actual argument.
My advice on dummy character argumemts is to (almost) always declare
them with assumed length (the * form that Herman shows). The exceptions
are too rare to worry about - rare enough that I'm having trouble
recalling one at the moment. I suppose that in theory, you might get
compiler error checking from the explicit-length form, but I don't
recall ever seeing such error checking actually happen. I've seen the
explicit-length form cause errors plenty of times, so that doesn't seem
like a good tradeoff.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- References:
- Passing Strings
- From: Michael Goerz
- Re: Passing Strings
- From: Richard Maine
- Passing Strings
- Prev by Date: Re: Passing Strings
- Next by Date: Re: chop the space after a string
- Previous by thread: Re: Passing Strings
- Next by thread: Re: Passing Strings
- Index(es):
Relevant Pages
|