Better code check before compile?


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,621


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    And the compiler is really only able (if so designed) to catch out-of-bounds error when you have a static index like that MAS[10]=20 but in many cases you're using an index variable like MAS[x]=20 and then there is no way for the compiler to know what x is going to be at runtime.

    On your typical 80's computer running BASIC, like the ZX Spectrum referenced earlier, the execution was interpreted so the interpreter could catch out of bounds errors during execution. PBP isn't interpreted but say it was or that it in some other way COULD detect that out-of-bounds error - what should happen?
    Last edited by HenrikOlsson; - 2nd November 2020 at 10:37.

  2. #2
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    Yes the example I have is static, not runtime occurrence.

  3. #3
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?


    Found another "bug" - if you put more DATA lines in code, than size of built-in eeprom, it will compile without errors, but PicKit 3 programmer will show you "Warning: Hex file loaded is larger than device."

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


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    Interesting... This is easy to check I guess.

    Ioannis

  5. #5
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    I made a typo, putting = instead of -

    hpwm 2,rmd*rmd=1,20000

    This statement does not produce any errors, as it should. Also, RMD value remains the same

  6. #6
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    Found another.

    Here is sample code, both variants should work same, but they don't

    Code:
    if ticker>150 and ard<140 and atrig=0 then
    ticker=1 
    atrig=1 
    endif
    This one is fine, but this one:
    Code:
    if ticker>150 and ard<140 and atrig=0 then ticker=1: atrig=1
    is not - atrig is always set to 1, no matter if ticker and ard values are as defined in if-then thing. It looks like that code after : is handled as separate code, not part of if-then. But, if I add say GOSUB XX after it, it is executed.

  7. #7
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    That is not bug. That way should work. This : is same as new row.
    So this line
    Code:
    if ticker>150 and ard<140 and atrig=0 then ticker=1: atrig=1
    is same as this

    Code:
    if ticker>150 and ard<140 and atrig=0 then ticker=1
    
    atrig=1
    I'm using PBP since 2004. And I found only one bug in pbp, and encounter multiple in MPASM.... DT helped me a lot to track bug to MPASM...

Similar Threads

  1. Code check and refinement suggestions?
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 31st July 2013, 02:37
  2. Replies: 4
    Last Post: - 24th January 2007, 22:20
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  4. Can some one please check my code out thanks
    By Jhdgkss in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th February 2006, 08:19
  5. Code check (sorry)
    By barkerben in forum General
    Replies: 5
    Last Post: - 30th November 2004, 15:54

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