Re: Assumed shape array help




"Dick Hendrickson" <dick.hendrickson@xxxxxxx> wrote in message
news:39QBe.1145745$w62.1088538@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>
>>
>> My interpretation of above is that my given example code
>>
>> call sub (x,size(x))
>>
>> with sub declared:
>> subroutine sub (x,n)
>> integer :: n, x(n)
>>
>> that does NOT use interfaces/modules would be checked, so nothing has
>> been gained
>> by use of a nasty explicit interface/module, the compiler still checks
>> for argument
>> consistency in my example, yes/no?
>>
>>
> That's the way I'd read it also. I'd say "that particular
> version of that particular compiler, under those
> circumstances, does some of the checking that you get when
> you use modules."
>
> Why not use the moudles? They work everywhere, they force
> checking of calls for every compiler, they let you do
> some more things (name hiding, generics, assumed shape
> arrays, etc.) that are often useful. It takes four (4!)
> lines to put your subroutine in a module, that's hardly
> a horrendous task for the average programmer. And, then
> you get a simplified argument list. You didn't say anything
> about my previous example of passing a couple of three
> dimensional arrays. Experience has shown that people
> sometimes mess up calls when there are 8 or 10 arguments.
> Let the compiler writer figure it out, he only has to do
> it once and once he finally gets it right, it will work
> forever for everybody.
>
> Dick Hendrickson
>

Speaking only for myself, I NEVER have occasion to exceed passing 2 - 2D
args and when I do they
are same dimension so call sub(a,b,n) is a STRETCH in my applications
and is a VERY neat solution.





.



Relevant Pages