Path: utzoo!attcan!uunet!lll-winken!ames!haven!umbc3!mbph!hybl From: hybl@mbph.UUCP (Albert Hybl Dept of Biophysics SM) Newsgroups: comp.lang.fortran Subject: An exercise in futility Keywords: The RIGHT number Message-ID: <588@mbph.UUCP> Date: 18 Jan 89 16:16:07 GMT Organization: University of Maryland, School of Medicine, Baltimore, MD 21201 Lines: 73 In message <454@loligo.cc.fsu.edu> mccalpin@loligo.cc.fsu.edu (John McCalpin: Supercomputer Computations Research Institute) writes: >In article <587@mbph.UUCP> hybl@mbph.UUCP (Albert Hybl >Dept of Biophysics SM) writes: Consider the following program: >>* Increase the value of K until the program fails. >> PARAMETER (K=24) >> CHARACTER AND(K)*1,DNA*(K) >> EQUIVALENCE (DNA,AND) >> DNA(K-23:K) = 'An exercise in futility!' >> PRINT *,K,(AND(J+K-24),J=1,24) >> END >>What does the ANSI X3.9-1978 standard say are the maximum allowable >>sizes for the character array AND(K)*1 and the character variable >>DNA*(K)? > >Of course *you* are waiting in the wings with the *right* answer to >this problem. What number do you suggest? I would like the maximum allowable sizes for the character array AND(K)*1 and the character variable DNA*(K) to be the same!!!.... If they were the same, then PARAMETER(K=nnnn) could be used to adapt a program to fit whatever available core the target machine may have. I think that the existence of the PARAMETER statement and the vagueness of the ANSI X3.9-1978 standard were meant to allow for processor size differences and not to give implementors a vehicle to demolish the standard. >... It sounds like you want a number >of several millions so that you can fit your genome sequences in. That >is nice, except that it means that in *your* world, no standard IBM PC >could ever have a valid Fortran language system, because there ain't >enough core.... CHARACTER AND(30000)*1 ! Is allowed on an IBM PC/RM fortran CHARACTER DNA*256 ! Is NOT--the compilation fails! Believe me, I want a portable fortran for the IBM PC, but when the implementor limits the string length of a character variable to the range 1-255, he has entered a possible winner in the FORTRAN demolition derby! I was pleased to see that the AT&T XLA+ fortran compiler do what I think the standard specifies; that is, the EQUIVALENCE (DNA,AND) statement works over the whole range of allowable AND(K)*1. As to wanting several million bytes, I'd use them if they were available; but--please give me the dynamic memory allocation routines like malloc, calloc, realloc, and free from the C language. I see no need to over utilize core, when I can process only a portion of the character string/array at a time. >... I, for one, would like any standard-conforming Fortran >system to include a document page listing the implementation-dependent >limitations, e.g.: > maximum size of character string (e.g. char*K string) maximum size of character array (e.g. CHAR*1 ARRAY(K)) > maximum integer value > maximum and minimum floating-point values > maximum array size (e.g. 64kB on old IBM PC compilers) maximum bytes per WRITE N, LIST > argument range limits for ALL intrinsic math functions > etc.... Hmmm, that sounds like an exercise in futility. ---------------------------------------------------------------------- Albert Hybl, PhD. Office UUCP: uunet!mimsy!mbph!hybl Department of Biophysics Home UUCP: uunet!mimsy!mbph!hybl!ah University of Maryland CoSy: ahybl School of Medicine Baltimore, MD 21201 Phone: (301) 328-7940 (Office) ----------------------------------------------------------------------