home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 2,723 of 2,978   
   Peter Dassow to Sv. Broholm   
   Re: Help ! Downgrade from Turbo Pascal 4   
   22 Jan 09 00:36:48   
   
   5796a946   
   From: z80eu@arcor.de   
      
   Sv. Broholm wrote:   
   > On 21 Jan., 09:29, Peter Dassow  wrote:   
   >> Sv. Broholm wrote:   
   >>   
   >>   
   >>   
   >>> On 20 Jan., 20:56, Peter Dassow  wrote:   
   >>>> Unfortunately a new problem occurs:   
   >>>> TP 3 does not anything about a forward declaration of a function.   
   >>>> So if there are 3 functions like a(d), b(e) and c(f),   
   >>>> and a(d) uses b(e) inside, and b(e) uses c(f) inside,   
   >>>> but c(f) uses also a(c) inside, that's Catch22 if you can't use forward   
   >>>> declaration.   
   >>> Forward declaration does exist in TP3, and it is similar to FORWARD in   
   >>> TP4.   
   >>> Show us your code.   
   >>> Regards   
   >>> Svend   
   >> That's astounding... but here are the three functions (Eval, Factor and   
   >> Term):   
   >>   
   >> [...]   
   >>   
   >> FUNCTION Eval: Integer; FORWARD;   
   >>   
   >> FUNCTION Factor: Integer;   
   >>   
   >> VAR   
   >>     word: String;   
   >>     val:  Integer;   
   >>   
   >> BEGIN   
   >>     word := GetWord;   
   >>     val  := 0;   
   >>          IF Length(word)=0           THEN Error('Missing operand')   
   >>     ELSE IF (word='.') OR (word='*') THEN val := locPtr   
   >>     ELSE IF  word='$'                THEN val := locPtr   
   >>     ELSE IF  word='-'                THEN val := -Factor   
   >>     ELSE IF  word='+'                THEN val := Factor   
   >>     ELSE IF  word='~'                THEN val := -Factor-1   
   >>      [..........many stuff deleted, see message entry before .........]   
   >>     Eval := val;   
   >> END;   
   >>   
   >> I will get always an error with TP3 (but not with TP4), regardless of   
   >> what order I use (what function comes first).   
   >>   
   >> Regards   
   >>   Peter   
   >   
   > Hi Peter,   
   > You say TP4 compiles correct. But does the program run correct and   
   > give correct results?   
   > I see function Term calls function Factor which might be correct. But   
   > function Factor calls function Factor recursive. See line 13 -15 in   
   > FUNCTION Factor. Is this as expected/correct ?   
   >   
      
   The program works if compiled with TP 4.0, and yes, recursive call is   
   wanted. It just says (because Forward Declaration as shown does NOT   
   work) Unknown Identifier.   
   If "forward declaration" works in TP 3.0, how does this declaration   
   differ from the shown one (at the beginning of my code snipplet) ?   
      
   Regards   
     Peter   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca