Menu

Autodeclare of variables

Dmitry
2023-06-03
2023-06-03
  • Dmitry

    Dmitry - 2023-06-03

    Basic is assumed as simply programming tool. But It is able to make serious projects.
    I meeted some ugly feature. Im debugging complex project. In the head is twisting algorithm. Syntax is often looses. I simply can make syntax error in variable name. Wrong named ones allocates and uses as normal. When I have 64 bit of ram, its signifucantly by amount of space. And when project runs, I have very interesting effects ))))))))))
    Im requesting to make such autoallocation optionally or even turn off at all. Where I can ask it?

     
  • Chris Roper

    Chris Roper - 2023-06-03

    try this:

    #Option Explicit
    Syntax:
    
        #option explicit
    This option ensures that all variables are dimensioned in the user program. The scope is the user code only and no other code space like .h or include files.
    
    #option explicit requires all variables,including bytes, in the user program to be defined.
    
    Variables can be defined and not used within your user program. Unused variables will not allocate memory.
    
    Introduction:
    
    Example:
    
        'Set chip model
        #chip 16f877a
    
        'Example command
        #option explicit
    
        dim myuserflag as byte
    
        myuserflag = true
    For more help, see Variable Lifecycle
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.