Announcement

Collapse
No announcement yet.

Power Basic CC5.0 Bug.....

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

  • Power Basic CC5.0 Bug.....

    Power basic CC50 seems bugged as it will not compile the following without a n error:

    #COMPILE EXE


    FUNCTION PBMAIN () AS LONG

    IF LC&<>0 THEN LPRINT ELSE LC&=-1
    PRINT "hello"


    END FUNCTION

    results in a syntax error as it does not like the ELSE statement

    also, following my earlier post on differences there is a bug with for next; it errors on compiling the following;
    FOR A=1 to 10
    For B= 1 to 10
    Print

    NEXT B,A

    as it expects a 2nd next statement - a work around is to use NEXT B:NEXT A but there does seem to be some bugs with this new version of the complier.

  • #2
    Regarding LPRINT statement I do not know, didn't test it.
    I suppose it expect something to print after LPRINT.
    Anyhow, attention: LPRINT is for printer and you need to attach a printer before using LPRINT. Maybe you intended PRINT statement?


    Regarding FOR/NEXT, from PBCC manual:
    "Note that PowerBASIC allows the Counter in the NEXT keyword simply as a comment, which is ignored."
    As far as I know NEXT B, A has never been a PB valid statement.
    For each FOR you need a NEXT

    Regards
    Eros
    Last edited by Eros Olmi; 1 Sep 2008, 03:37 PM.
    thinBasic programming language
    Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

    Comment


    • #3
      Thanks for your help - yes, changing the lprint to have null string cures the problem - so lprint"" and the manual for v4.0 does say next x,y is legal but changing this to seperate next's cures the problem (and looks clearer as well!) ao my code of 700k now compiles with no problem so I can now get on to using the new features of version 5.

      Comment


      • #4
        Well, FOR/NEXT nesting is also mentioned in PBCC400 manual. This is the text you will find in version 400:
        FOR/NEXT loops can be nested within other FOR/NEXT loops. Be sure to use unique counter variables. Note that PowerBASIC allows the Counter in the NEXT keyword simply as a comment, which is ignored. For example, the following will compile, even though the counter variables are "crossed":

        FOR n = 1 TO 10
        FOR m = 1 TO 20
        .
        .
        .
        NEXT n
        NEXT m
        You can omit the counter variable in the NEXT statement altogether. For example:
        FOR n = 1 TO 10
        .
        .
        .
        NEXT
        Instead reading LPRINT syntax, it seems supposed to work even with "no statements" after it (all statements are optional). I thing you should write your code in this way:
        Code:
        IF LC&<>0 THEN
          LPRINT
        ELSE
          LC&=-1
        END IF
        instead of a single line. But I didn't test it. Just imagination

        Ciao
        Eros
        thinBasic programming language
        Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

        Comment


        • #5
          I confirm that the example given in the PB/Win9 help of valid syntax:

          Code:
          FOR n = 1 TO 10
            FOR m = 1 TO 20
              FOR q = 1 TO 100
                .
                .
                .
          NEXT q,m,n ' Can also use: NEXT ,,
          Does not compile (NEXT required error) under PB/Win9. It does compile under PB/Win8 though.
          - LJ

          Comment

          Working...
          X