|
Post by larrybtoys on Aug 30, 2023 11:26:29 GMT 1
How important is it to change all of the AUTO commands at the beginning of a program to GLOBAL when doing a final compile? I like using AUTO while developing a new program but sometimes forget to change them to GLOBAL at the end. Does this matter or does the compiler automatically do it for me during the compile? TIA
|
|
|
Post by Roger Cabo on Aug 30, 2023 15:15:49 GMT 1
From what I now, there is no difference between Auto and Global for TYPE of a variable.
But Auto doesn't refine the variable type if it has already. Once you have used:
Auto a As Double a = 18 ____________________________________________________
But then you like to change a to a = "uio"
Auto will not change your variable type automatically to String or variant on the next F5 or F5+SHIFT.
____________________________________________________
And string can't be defined while
Auto a = "slfkö"
But with:
Auto a$ a$ = "slfkö"
I use Auto only when I'm to lazy while generate quick code to test anything. But if you postfix any variable like: a$,b%,c|,d#, auto knows what to do.
And I never had any issues with Auto in a compiled exe.
|
|
|
Post by (X) on Aug 30, 2023 16:16:24 GMT 1
For the benefit of those that have not yet installed GFA-BASIC 32 for Windows. Here is an exerpt from the Help Document.
|
|
|
Post by larrybtoys on Aug 30, 2023 17:08:48 GMT 1
Are you saying that a compiled program will run faster when the variables have been specifically declared using GLOBAL etc. rather than using Auto? Or just in the NON-Compiled versions?
|
|
|
Post by dragonjim on Aug 30, 2023 23:03:27 GMT 1
Only when compiled within the IDE. When the listing is compiled to executable, the Auto is replaced with Global or Dim so there should be no loss of performance.
|
|