Announcement

Collapse
No announcement yet.

Assignment of values to constants

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

  • Assignment of values to constants

    Is the compiler supposed to allow the use of logical operators when assigning values to integer constants? For example, the following code will refuse to compile in PB/DOS v3.5:
    Code:
    %CONST1  = 1
    %CONST2  = 2
    %CONST3  = %CONST1 OR %CONST2
    My PB/DOS manual clearly says that "You can use an expression as long as all parts of the expression are constant." This would work in PB/CC or PB/DLL, so is there some reason why it can't/won't work in PB/DOS?
    If you try to make something idiot-proof, someone will invent a better idiot.

  • #2
    Equate assignments can include numeric expressions, and the NOT operator only... other bitwise operators are not supported at this time (such as OR, AND, XOR, etc).

    The following are valid:
    %a = 1
    %b = %a + 1
    %c = %a * %b
    %d = %a \ b%
    %e = %a / %b
    %f = NOT e%

    -------------
    Lance
    PowerBASIC Support
    ( mailto:[email protected][email protected]</A> )
    Lance
    mailto:[email protected]

    Comment


    • #3
      In that case, I can only hope this issue is on the To Be Fixed list for PB/DOS v4, along with the addition of string constants.

      [This message has been edited by Matthew Berg (edited January 05, 2000).]
      If you try to make something idiot-proof, someone will invent a better idiot.

      Comment


      • #4
        I'll pass your request on to be added to the "wish list" for new features, although I'm fairly sure string equates is already on the list.

        Please note that PB/DOS has never supported bitwise operators in equate assignment expressions, so therefore this is NOT actually an "issue" or bug with the compiler!

        -------------
        Lance
        PowerBASIC Support
        ( mailto:[email protected][email protected]</A> )
        Lance
        mailto:[email protected]

        Comment


        • #5
          Please note that PB/DOS has never supported bitwise operators in equate assignment expressions, so therefore this is NOT actually an "issue" or bug with the compiler!
          I surmised it probably wasn't a bug when I tested the same code in PB/DOS v3.2 and got the same result. I guess then it depends on your definition of "issue" - but put it on the New Features list instead if that makes you happier!
          If you try to make something idiot-proof, someone will invent a better idiot.

          Comment

          Working...
          X