home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4586 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.9 KB  |  55 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
  3. From: dmurdoch@QueensU.CA (Duncan Murdoch)
  4. Subject: Re: Is this legal - why/why not?
  5. Message-ID: <Bs47KJ.7tz@knot.ccs.queensu.ca>
  6. Keywords: Pascal Syntax, Semantics
  7. Sender: news@knot.ccs.queensu.ca (Netnews control)
  8. Organization: Queen's University, Kingston, Canada
  9. References: <l7b682INNasf@muleshoe.cs.utexas.edu>
  10. Date: Tue, 28 Jul 1992 20:00:18 GMT
  11. Lines: 42
  12.  
  13. In article <l7b682INNasf@muleshoe.cs.utexas.edu> sirosh@cs.utexas.edu (Joseph Sirosh) writes:
  14. >I have two questions.
  15. >
  16. >1. The following declaration for an enumerated type is legal.
  17. >    Type Used = (Integer, Char, Boolean);
  18. >
  19. >even though Integer, Char, Boolean etc. are names of predefined types.
  20. >This works on Think Pascal on the Mac.
  21. >
  22. >However, the following declaration does not work, though Pascal definition
  23. >does not say anything against it.
  24. >
  25. >    Type Used2 = (Integer);
  26. >
  27. >The error message from the compiler is 'This does not make sense'.
  28.  
  29. Is this in Think Pascal again, or what compiler?  It works
  30. in TP 6.0.
  31.  
  32. >Why? Why is this declaration illegal?
  33.  
  34. One thing that would make it illegal would be to precede
  35. it by the first one defining Used.  You can't repeat identifiers
  36. (i.e. "integer") in enumerated type definitions.  Another 
  37. possibility is that there's a bug in your compiler.
  38.  
  39. >2. The second question is similar. How come the following declaration
  40. >does not work,
  41. > Var ar1: array[Integer] of char;
  42. >
  43. >but something Var ar2: array[char] of char; does? I can understand 
  44. >arguments of memory limitations, but the error message given by the
  45. >compiler seems to imply syntactic error.
  46.  
  47. Again, it works in TP 6.0 (i.e. it gives an error
  48. "structure too large").  However, if you put that
  49. redefinition of "integer" first, then it's a syntax
  50. error.  You need a range of indices for an array
  51. definition, not a single constant.
  52.  
  53. Duncan Murdoch
  54.  
  55.