home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!elroy.jpl.nasa.gov!usc!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
- From: dmurdoch@QueensU.CA (Duncan Murdoch)
- Subject: Re: Is this legal - why/why not?
- Message-ID: <Bs47KJ.7tz@knot.ccs.queensu.ca>
- Keywords: Pascal Syntax, Semantics
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University, Kingston, Canada
- References: <l7b682INNasf@muleshoe.cs.utexas.edu>
- Date: Tue, 28 Jul 1992 20:00:18 GMT
- Lines: 42
-
- In article <l7b682INNasf@muleshoe.cs.utexas.edu> sirosh@cs.utexas.edu (Joseph Sirosh) writes:
- >I have two questions.
- >
- >1. The following declaration for an enumerated type is legal.
- > Type Used = (Integer, Char, Boolean);
- >
- >even though Integer, Char, Boolean etc. are names of predefined types.
- >This works on Think Pascal on the Mac.
- >
- >However, the following declaration does not work, though Pascal definition
- >does not say anything against it.
- >
- > Type Used2 = (Integer);
- >
- >The error message from the compiler is 'This does not make sense'.
-
- Is this in Think Pascal again, or what compiler? It works
- in TP 6.0.
-
- >Why? Why is this declaration illegal?
-
- One thing that would make it illegal would be to precede
- it by the first one defining Used. You can't repeat identifiers
- (i.e. "integer") in enumerated type definitions. Another
- possibility is that there's a bug in your compiler.
-
- >2. The second question is similar. How come the following declaration
- >does not work,
- > Var ar1: array[Integer] of char;
- >
- >but something Var ar2: array[char] of char; does? I can understand
- >arguments of memory limitations, but the error message given by the
- >compiler seems to imply syntactic error.
-
- Again, it works in TP 6.0 (i.e. it gives an error
- "structure too large"). However, if you put that
- redefinition of "integer" first, then it's a syntax
- error. You need a range of indices for an array
- definition, not a single constant.
-
- Duncan Murdoch
-
-