Author Topic: Working with select case. Old school or new code? Trouble with loops.  (Read 2650 times)

0 Members and 1 Guest are viewing this topic.

Offline Abramhollon

  • Newbie
  • Posts: 3
From my understanding of select case back in QBasic the compiler treated select case odd.  It did not compile select case as part of the loop instructions. The compiler set a pointer or some sort of jump to execute select case when a simple conditional was met.  It was known that if you used select case your loop would slow down.  I am trying to do this for reasons I will expound upon; however qb64 might handle a select case as part of a loop compilation thus giving a loop with select case normal speeds for a loop.  If this is so maybe someone can help me with understanding how other options for flow control work. 
I am using the qb1.1 and haven’t upgraded yet, and my code needs a breach in the loop so that the process tree will interpret my code as foo not foobar or something like that (vise versa, but who really knows).
The reason for this is so that I can.process _sndrawlen as a separate ‘object’ in as witch _sndraw is processed.  Not only that, but _sndrawlen needs to be processed after _sndraw.
Maybe by chance _sndraw is updated in 1.2. 
Is there a discussion on loop control that will answer this?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Hi Abramhollon,

Welcome to the forum!

Always helpful to include code or simple example to illustrate what you are asking or commenting on.

Wiki usually has most current info on commands and usually with examples.
https://www.qb64.org/wiki/Main_Page

Does this help?

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
Here is change log to last update 1.2
https://www.qb64.org/qb64-1.2-changelog.txt

There have been some changes to _sndrawlen and other _sndraw...

I confess, I am having tough time understanding what you mean with loop control and select case, 2 different things.

If you don't like select case there is IF, ElseIF, ElseIF... Else, End IF almost the same thing.

And a number of ways to do Loops.

« Last Edit: March 02, 2018, 02:26:07 pm by bplus »

FellippeHeitor

  • Guest
It was known that if you used select case your loop would slow down.  I am trying to do this for reasons I will expound upon; however qb64 might handle a select case as part of a loop compilation thus giving a loop with select case normal speeds for a loop.  If this is so maybe someone can help me with understanding how other options for flow control work.

Both SELECT CASE and IF are translated to if () {blocks} in C++, so it doesn't matter speed-wise (I believe).

I don't understand your request though. What are you trying to accomplish?
« Last Edit: March 02, 2018, 03:01:11 pm by FellippeHeitor »

Offline Abramhollon

  • Newbie
  • Posts: 3
I am trying to use _sndraw as a live update to sound as the sound is modified.  I am also making a buffer countdown using sndrawlen, but now that I remember another peace of code I wrote I can just use a buffer that will transfer its contents to sndraw.