- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page