Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Other peoples code

Intel_C_Intel
Employee
366 Views
We are trying to get someone else's code to work. I think it is a little suspicious. An array of types is passed to a subroutine where the relevant argument has an assumed size. Futher on in the code, the size of the array is assumed (literally) to be at least a certain size and an attempt is made to allocate the size of a member of the passed type.
Do people agree this is flaky?
Its like:
SUBROUTINE blah(a, b)
TYPE(A) a
TYPE(B) b(*)
. . .
IF (.NOT. ALLOCATED(b(2).Scaled)) THEN ALLOCATE(b(2).Scaled(1:n_Variables))
END IF
. . .

Message Edited by Judd on 03-31-2004 01:44 PM

Message Edited by Judd on 03-31-2004 01:44 PM

0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
366 Views

Well, I think flaky is a bit harsh... let's phrase it this way -- this code assumes that b will be at least of size 2. I guess that it's nowhere checked that's indeed so, but I've seen far worse assumptions and total absence of error checking... IMO this one falls in "we all do it every day when we don't exactly feel like coding" category...

Jugoslav

0 Kudos
Reply