Fixed PRINT 5 - - 5

by (no login)

In C when two - operators are next to each other they become a different operator. They must be separated by a space in the C code to fix this. QB64 was not compiling minus-minus-number correctly.

This fix happened from investigation of qbguy's bug report:
a=3
b=2
PRINT A+++++B
PRINT A-----B
Still produces a mysterious C++ error -- should print 8 and -2

Of course multiple +'s and -'s are not normal code, but 5--5 certainly is. By applying some simple checks I was able to get QB64 to process even bizarre combinations of + and - operators in a row just like QBASIC. I hope no one will type:
PRINT -4+-+-+--+-+--+---+---+-+-++-++--+-+++-++--++-+--+-+---++-+-3
PRINT -+56+5+--+5+-5+-+5+-+-+5+-5-55-+-5-+-5+-+-5+5+-+55+-+-+-5+-+5+--+5

...but just in case they do, QB64 will be ready!

Thanks qbguy,
Galleon

Posted on Apr 5, 2008, 1:29 AM
from IP address 58.106.166.186

Respond to this message   

Return to Index


Response TitleAuthor and Date
Nicely done.rpgfan3233 on Apr 5
 It works out as 5 + (+++++++5)counting_pine on Apr 5
  How this is achieved... on Apr 5
   Technically, "- -" has a different effect...counting_pine on Apr 6
    I respect counting_pine but as a developer at FB.netroy on Apr 6
     Competitors? QB64 has nothing to do with FB yet on Apr 6
     We all respect everybody here in QBasic land on Apr 6
      Not competitors?roy on Apr 7
       Not a competition but... on Apr 7
        *FB does support GOSUB/RETURN and ON ERROR GOTO ... on Apr 7
        Excuse me for complimenting somebody! on Apr 7
         Is this your professional opinion? ... on Apr 7
          Read Galleon's opinion and his thanks to counting pine on Apr 7
        I didn't come here to antagonise the situation...counting_pine on Apr 7
         * AMEN on Apr 7
         The Underscoresqbguy on Apr 7
         * I personally enjoy seeing your posts, counting_pine. on Apr 7
          So do Iroy on Apr 7
           * Roy is a piece of CRAP and makes the FB problem! on Apr 8
        My apologies to counting_pine RE: any anti-FB sentiment in my above post on Apr 8
       The KING of strokers.........Roy! on Apr 7