home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / fortran / 3232 < prev    next >
Encoding:
Text File  |  1992-08-27  |  1.7 KB  |  44 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!ames!agate!dog.ee.lbl.gov!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
  3. From: jlg@cochiti.lanl.gov (Jim Giles)
  4. Subject: Re: Small Language Wanted
  5. Message-ID: <1992Aug27.172642.18866@newshost.lanl.gov>
  6. Sender: news@newshost.lanl.gov
  7. Organization: Los Alamos National Laboratory
  8. References: <H.3lvmyc56w&A@lionbbs.bs.open.de> <17gsgnINN903@network.ucsd.edu> <9224014.17999@mulga.cs.mu.OZ.AU>
  9. Date: Thu, 27 Aug 1992 17:26:42 GMT
  10. Lines: 32
  11.  
  12. In article <9224014.17999@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  13. |> [...]
  14. |> >: > And arrays, C has no true array type
  15. |> >: > like Fortran does (One must use pointers to pointers ... to pointers).
  16. |> >: Did you ever try:     int a[12][34];
  17. |> >: And             :     a[x][y] = somewhat;
  18. |> >
  19. |> >Yes, but try to use "a" in a subroutine.
  20. |> 
  21. |> void subroutine(int a[12][34]) {...}
  22. |> 
  23. |> If there are problems, could you please explain them better?
  24.  
  25. try:
  26.  
  27.    void subroutine(n, m, a[n][m]) {...}
  28.  
  29. Like for writing something as trivial as a matrix multiply routine
  30. which can multiply conformable arrays of any size:
  31.  
  32.    void mat_mult(i, j, k, a[i][k], b[i][j], c[j][k])
  33.    {... /* returns `a' since arrays are passed by reference */ ...}
  34.  
  35. Actually, this could be done by eliminating a *single* constraint in 
  36. the C standard - that is, the one which requires array sizes in declarations
  37. to be constant-expressions instead of allowing expressions in globals and/or 
  38. preceeding parameters.  I don't have the rationale document in from of me,
  39. so I don't know why they left that constraint in (or if the explained at
  40. all).
  41.  
  42. -- 
  43. J. Giles
  44.