home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- 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
- From: jlg@cochiti.lanl.gov (Jim Giles)
- Subject: Re: Small Language Wanted
- Message-ID: <1992Aug27.172642.18866@newshost.lanl.gov>
- Sender: news@newshost.lanl.gov
- Organization: Los Alamos National Laboratory
- References: <H.3lvmyc56w&A@lionbbs.bs.open.de> <17gsgnINN903@network.ucsd.edu> <9224014.17999@mulga.cs.mu.OZ.AU>
- Date: Thu, 27 Aug 1992 17:26:42 GMT
- Lines: 32
-
- In article <9224014.17999@mulga.cs.mu.OZ.AU>, fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
- |> [...]
- |> >: > And arrays, C has no true array type
- |> >: > like Fortran does (One must use pointers to pointers ... to pointers).
- |> >: Did you ever try: int a[12][34];
- |> >: And : a[x][y] = somewhat;
- |> >
- |> >Yes, but try to use "a" in a subroutine.
- |>
- |> void subroutine(int a[12][34]) {...}
- |>
- |> If there are problems, could you please explain them better?
-
- try:
-
- void subroutine(n, m, a[n][m]) {...}
-
- Like for writing something as trivial as a matrix multiply routine
- which can multiply conformable arrays of any size:
-
- void mat_mult(i, j, k, a[i][k], b[i][j], c[j][k])
- {... /* returns `a' since arrays are passed by reference */ ...}
-
- Actually, this could be done by eliminating a *single* constraint in
- the C standard - that is, the one which requires array sizes in declarations
- to be constant-expressions instead of allowing expressions in globals and/or
- preceeding parameters. I don't have the rationale document in from of me,
- so I don't know why they left that constraint in (or if the explained at
- all).
-
- --
- J. Giles
-