Announcement

Collapse
No announcement yet.

call immediately follwoing do while bug?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • call immediately follwoing do while bug?

    The following program (a.pbs) will compile with PBDos 3.5 and run
    using a dos environment:

    CLS
    f%=FREEFILE: OPEN "a.pbs" FOR INPUT AS #f%
    FOR i%=1 TO nt%-1: LINE INPUT #f%,l$: NEXT i%
    DO WHILE NOT EOF(f%)
    i%=0 'unbreak compiler
    CALL vgasu() 'fixme: cause compiler to fail!
    FOR i%=1 TO 25
    IF EOF(f%) THEN EXIT LOOP
    LINE INPUT #f%,l$
    PRINT USING "#####: &";nt%,l$
    nt%=nt%+1
    NEXT i%
    LOOP
    CLOSE #f%

    SUB vgasu()
    END SUB

    Remove the line (or commented out) will cause the compile to
    freeze after pass 1...

    Please advise, thanks...
    Ed

    ------------------

  • #2
    Looks like a compiler problem, maybe related to CALLs with an
    explicit empty parameter list. I'll file it with R&D. Meantime,
    replace your call like so:
    Code:
       CALL vgasu
    BTW, did you expect that first FOR loop to do something? NT% isn't set.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Comment


    • #3
      Sorry about the line...

      FOR i%=1 TO nt%-1: LINE INPUT #f%,l$: NEXT i%

      just a sloppy cut and paste.


      Note: I do use 'CALL functionname()' and 'CALL subroutinename()'
      calling functions/subs with no parameters all the time.
      Only in the example, does the problem shows itself.

      Thanks...
      Ed

      ------------------

      Comment

      Working...
      X