QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: Pete on April 10, 2021, 01:18:03 pm

Title: Major QB64 bug causing global climate change.
Post by: Pete on April 10, 2021, 01:18:03 pm
Well, maybe not that big of a deal, but riddle me this guys. Why does the QB64 IDE except this???

Code: QB64: [Select]
  1. nexti% = -nexti% s

Naturally, it won't compile. It should throw an IDE error, but it doesn't. It just gives the OK!

This occurs in both in Versions 1.3 and 1.5, so my guess is it just has never been discovered before.

Pete
Title: Re: Major QB64 bug causing global climate change.
Post by: SpriggsySpriggs on April 10, 2021, 01:26:47 pm
But why would you do this? I don't see how that could be accounted for when no one could expect that sort of syntax misuse
Title: Re: Major QB64 bug causing global climate change.
Post by: Pete on April 10, 2021, 01:42:41 pm
So instead of...

nexti% = -nexti% s

...let's say you write...

nexti% = -nexti% s s

Now it sends a proper error message, telling the user it expects an operator in the equation.

So how did I stumble on this monumental find you ask? Well, sometimes I use bookmarks but sometimes I just type "s" on a line by itself, when working on a large project. That way, I can go through the code, and quickly return to my work area, by using the IDE error message "jump there" to go back to my work area. So today I got lazy, and typed the "s" on a code line, figuring it would error out the same. I was surprised when it didn't.

Pete

Title: Re: Major QB64 bug causing global climate change.
Post by: SpriggsySpriggs on April 10, 2021, 01:50:36 pm
Ah! I see! Using a syntax error as a bookmark is clever!
Title: Re: Major QB64 bug causing global climate change.
Post by: bplus on April 10, 2021, 02:06:19 pm
It's odd you need the - sign to make it NOT error.

Also
Code: QB64: [Select]
  1. next% = - next% s
does NOT error either
Title: Re: Major QB64 bug causing global climate change.
Post by: Pete on April 10, 2021, 03:02:29 pm
It's odd you need the - sign to make it NOT error.

Also
Code: QB64: [Select]
  1. next% = - next% s
does NOT error either

Well, you need to make that nexti%, instead of next%, as that is a reserved word. Also, If you do a carriage return, you will see the IDE puts the negative sign next to the variable, automatically.

You did inspire me to look further, as that negative sign has something to do with it.

For example. It wrongly accepts...

Biden = -b s

but properly flags...

Biden = b s

Pete


Title: Re: Major QB64 bug causing global climate change.
Post by: bplus on April 10, 2021, 03:55:36 pm
Who knew the IDE was a Biden fan ;-))
Title: Re: Major QB64 bug causing global climate change.
Post by: Pete on April 10, 2021, 04:04:31 pm
I know that fan. It's the one that Schiff hit.

Pete