Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Metacommand
#1
Hi,

I have an issue with a metacommand:

$Checking:off

does not allow a line number:

100 $Checking:off

Could some QB64PE editor add the possibility of a line number?

Thanks, Erik.

btw: actually none of the metacommands do.
except for $Dynamic $Static and $Include which require Rem..
Reply
#2
Why would metacommands need line numbers? In fact why use line numbers at all except when dealing with loading/editing legacy code? I'm not trying to be flippant, it's just that I don't think I've seen anyone creating new projects in the last 10 years using QB64 and line numbers.
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#3
good question @TerryRitchie I await to see if Erik does have good reason.

How can it be a compatibility issue with new meta's???

Maybe Erik is coding something that requires Line Numbers for everything? He does seem a bit stuck in the past IMHO. Don't mean disrespect because I am same in reuctance in not exploring _GL nor memory stuff.
b = b + ...
Reply
#4
My reasoning is thus:

The code is for Strek from bcg.zip of David Ahl.. (in the games forum).

It is not only QB backward compatible but the original source is line number oriented for basica.com
so I left the line numbers in.. Then I noticed the metacommands not being supported..

No great deal but an interesting question!

Erik.
Reply
#5
(07-28-2024, 11:44 PM)eoredson Wrote: My reasoning is thus:

The code is for Strek from bcg.zip of David Ahl.. (in the games forum).

It is not only QB backward compatible but the original source is line number oriented for basica.com
so I left the line numbers in.. Then I noticed the metacommands not being supported..

No great deal but an interesting question!

Erik.

You can simply enter a metacommand in between line numbers without affecting the flow of a program.

Even if you could put a metacommand on a line number you would not be able to run the modified code in GW-Basic (BASICA) any way. In other words, QB64 code (metacommands in this case) is not backwards compatible with GW-Basic.


10 CLS
20 PRINT "COUNT FROM 1 TO 32767"
$CHECKING:OFF
30 FOR I = 1 TO 32767
40 PRINT "I";
50 NEXT I
$CHECKING:ON
New to QB64pe? Visit the QB64 tutorial to get started.
QB64 Tutorial
Reply
#6
The other thing about $Checking is:

Code: (Select All)

On Timer(1) GoSub 100
Timer On
$Checking:Off
Do
  x$ = InKey$
  If Len(x$) Then End
Loop
End

100 x = x + 1
Print x;
Return

that checking off will decrease the .exe by about 200K but overrides the timer!?

Actually this code will hang:

Code: (Select All)

$Checking:Off
On Error GoTo 100
Print Sqr(-1)
End
100 Print "error": End

Reply
#7
Of course it will hang.  You turned off all error checking and error handling, and then you toseed an error.  What did you expect to happen?

It's just like tossing all the food and drink out of your house to have a cleaner, barer home.  And then you get hungry, and open the fridge to....   just do nothing but drool in hunger.

Checking:off only goes around code that you KNOW is 100% error free.
Reply
#8
@eoredson I would clarify that `$Checking:Off` makes code smaller and run faster by removing the code that runs the error handlers, runs timers, runs `On X`, etc. between each line. It's not a general purpose "make the code faster" command, it's for the specific use-cases where the event checking is negatively impacting the performance of a piece of code and you know that the event checking is unnecessary for that part (Because it runs fast enough to not impact timers, won't produce errors, etc.)

I would additionally note that most commands check if there is a pending error before doing anything, so if an error does happen during a `$Checking:Off` block that can basically disable all the code until the program runs a line in a `$Checking:On` section.
Reply




Users browsing this thread: 6 Guest(s)