Long Variables can be negative?


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Long Variables can be negative?

    It WILL work only if you use PBPL because the result is stored temporarily in a long variable. This variable is checked, so yes it will work fine.

    For more info check the new PBP manual that clarifies the case.

    Ioannis

  2. #2
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Long Variables can be negative?

    Isn't result stored in BVal in this example?
    BVal = BVal - 1
    Result in BVal is 255(Checked with debugger). And because BYTE is unsigned it can't be negative. Program won't jump to negative.
    Then tried: If BVal - 1< 0 THEN Negative
    Then is negative.
    I really can't see how value in this statement is stored at end in temp var BVal = BVal - 1.
    That code is same as:
    Temp=BVal - 1
    BVal =Temp
    So we loose sing when value is passed to BVal.
    I'm done my homework, now you do yours

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Long Variables can be negative?

    Page 84-85 of the manual.

    Ioannis

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Long Variables can be negative?

    Page 81 and 82 of my manual... But who reads stinken manuals....
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Long Variables can be negative?

    From manual...
    Bval=-1 (Same as Bval =0:Bval=Bval-1)
    If ( Bval < 0 ) THEN negative 'Will never test true
    So second example from post #4 vil never test true...

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Long Variables can be negative?

    What PBP compiler are refering to?

    I said, it will work on PBPL

    NOT on PBPW

    David, the manual I as refering to is the revision of Revised November 28, 2011.

    Ioannis

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts