home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- From: jes@grendel.demon.co.uk (Jim Segrave)
- Path: sparky!uunet!pipex!demon!grendel.demon.co.uk!jes
- Subject: Re: converting C 'for' to PASCAL 'FOR'
- Distribution: world
- References: <1992Jul28.151937.247@falcon.navsses.navy.mil>
- Organization: None
- Lines: 30
- Date: Wed, 29 Jul 1992 13:28:59 +0000
- Message-ID: <712441739snx@grendel.demon.co.uk>
- Sender: usenet@gate.demon.co.uk
-
-
- In article <1992Jul28.151937.247@falcon.navsses.navy.mil> huynh@falcon.navsses.navy.mil writes:
-
- > Hello,
- >
- > I am curious if there is a way to translate the "C" for(i,start,last,incr)
- > statement into the PASCAL FOR i = start to last DO (* incr = 1 *).
- > I am interested in doing this using the #define statement.
- > Has anyone done this? Help is much appreciated.
- >
- > Here is an example of how the "C" 'for' statement is translate into FORTRAN
- > 'DO':
- > #define DO(i,start,last,incr) for((i)=(start);(i)<=(last);(i)+=(incr))
- I think the Pascal FOR doesn't do the assignment if the condition is not met:
- so
- i := 2;
- FOR i := 3 TO 0 ...
- would never assign 3 to i, since the loop wouldn't execute.
- I could be wrong, it's been years since I read the User Manual and
- Report (which may not be ANSI/ISO anyway).
- >
- > Thanks in advance.
- >
- > Nhan H. Huynh, PASCAL 's structure 's best
- > Science and Engineering Aprrentice, Naval Base, Philadelphia PA.
- >
- >
- --
- Jim Segrave (Segrave Software Services) jes@grendel.demon.co.uk
-
-