Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!orstcs!jacobs.CS.ORST.EDU!louxj From: louxj@jacobs.CS.ORST.EDU (John W. Loux) Newsgroups: comp.sys.hp Subject: Re: Disturbing Pascal Behavior Message-ID: <11792@orstcs.CS.ORST.EDU> Date: 22 Jul 89 18:16:49 GMT References: <231@bnrunix.UUCP> Sender: usenet@orstcs.CS.ORST.EDU Reply-To: louxj@jacobs.CS.ORST.EDU.UUCP (John W. Loux) Organization: Solve and Integrate, Corp. - Corvallis Oregon Lines: 39 In article <231@bnrunix.UUCP> rick@bnrunix.UUCP (Richard Johns X7191) writes: > >function poops(s : string[80]) : string[80]; > >and get: > > 7: 7:D 1 function poops(s : string[80]) : string[80]; > ^^ ^^ >>>>>>> Error at f.p/7 > >What's the story? I can declare variables of type string, but can't put them >into a function declaration with or without the "[80]", using VAR, or using >$ALLOW_PACKED$. I have seen anything in the manual that says it shouldn't be >possible. My manual says that the result type must be "any previously defined type". Though this does not completely or sufficiently address your case (and a cursory examination of the manual fails to shed any more light), I have either read somewhere or gleaned from experience that both the return type of functions and the parameter types of both functions and procedures MUST be predefined types. STRING[80] is a type declaration, not a predefined type. For this reason, scalar declarations (i.e., 0..9) and record declarations are also forbidden. $ALLOW_PACKED$ has nothing to do with it. (This has been my experience with HP Pascal since it was introduced on the first series 200 machines.) Thus, define TYPE strng = STRING[80]; and your function as FUNCTION poops(s : strng) : strng; and all should be well. John W. Loux louxj@jacobs.cs.orst.edu