Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?
From: Richard Maine (nospam_at_see.signature)
Date: 12/19/03
- Next message: Richard Maine: "Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?"
- Previous message: Andrew Smith: "Re: Salford error on Win XP"
- In reply to: Charles Russell: "Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?"
- Next in thread: Tim Prince: "Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 19 Dec 2003 09:37:10 -0800
"Charles Russell" <STOPworworSPAM@bellsouth.net> writes:
> Why would one ever use a final dimension of 1 for any reason but assumed
> size?
Innumerable reasons. I assure you that in the "why would anything
ever do anything so strange" list, this one is pretty mundane.
Fundmentally, it is a valid, natural, and sensible thing to do for
quite a few situations. The fact that some of them could also be
written as scalars doesn't automatically mean that everyone necessarily
wants to in all cases.
Rank matters. Just because an array of size 1 has only one element,
that does not make it the sam ething as a scalar. It might logically
still be an array of size 1. Some people might find it more natural
to write it that way...and there are places where the standard
*REQUIRES* you to write it that way.
For example, suppose you have a subroutine with an array dummy
argument. The standard does not allow you to pass a named scalar
variable to it as an actual argument (except for an array element,
which is a special case). It will often, perhaps even usually, work
anyway, but it has never been standard-conforming. Quite a few
current compilers will bitch about it if you don't manage to "hide"
the problem from them. And it won't work at all with generics in
any compiler.
Also, automatic code writing software isn't likely to special-case
a size of 1. Why should it? If something is logically an array,
but the application in question needs only a single element, it
would be a lot of mostly pointless complication for the software
to change it to a scalar (even more so if multiple cases needed
to work together - some size 1 and some larger).
Or human written software can have the same issues of why do the
special case differently. Writing specific application modules to go
in a general program. The program handles arrays of arbitrary size
for something. I have only one of them for the current application.
Just give the program the natural size 1 array. That will sure make
it easier if I later add a second one. Besides that way I'll just
need to follow exactly how the program documentation shows to set up
things. I might even have a template of declarations and interface to
copy from. Why go out of my way to change it?
There are also a bunch of reasons that are a bit on the strage side
and mostly nonstandard, but the ones above are pretty mundane and
standard-conforming (and even required for standard conformance
in some cases).
Occasionally there can be reason to write the special case differently.
Perhaps you'll get better performance or something. The same
answer isn't best for all cases.
Next you are going to ask why anyone would write an array of size
zero. Yes, I've seen that one also. Done it even, for multiple
reasons. Most common is when my particular application doesn't
use one feature of a general program. Also occasionally done it
for more obscure reasons.
-- Richard Maine email: my last name at domain domain: sumertriangle dot net
- Next message: Richard Maine: "Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?"
- Previous message: Andrew Smith: "Re: Salford error on Win XP"
- In reply to: Charles Russell: "Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?"
- Next in thread: Tim Prince: "Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|